Debian8 部署 laravel 5.3 (php7.0 + nginx)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Debian8 部署 laravel 5.3 (php7.0 + nginx)相关的知识,希望对你有一定的参考价值。

web根目录:/var/www/html

更换 apt-get 源
cd /etc/apt/sources.list
deb http://ftp.debian.org/debian jessie main contrib non-free
deb http://ftp.debian.org/debian jessie-updates main contrib non-free
deb http://security.debian.org jessie/updates main contrib non-free
deb http://packages.dotdeb.org jessie all
deb http://ftp.debian.org/debian jessie-backports main

更新 apt-get 源
apt-get update

安装composer
apt-get install composer

新建laravel项目
cd /var/www/html
composer create-project laravel/laravel app --prefer-dist
chmod -R 755 app
cd app
chmod -R 777 bootstrap
chmod -R 777 storage

安装php7.0
apt-get php php-fpm

安装nginx
apt-get nginx

编辑php.ini
vim /etc/php/7.0/fpm/php.ini
;cgi.fix_pathinfo=1修改为cgi.fix_pathinfo=0

编辑nginx配置
vim /etc/nginx/sites-enabled/default

server {
    listen 80;
 
    server_name app.com; #你的域名
    root /var/www/html/app/public;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
 
    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }


    location ~ /\.ht {
        deny all;
    }

}

技术分享

嘿嘿,mysql自行安装,以及php相关扩展

以上是关于Debian8 部署 laravel 5.3 (php7.0 + nginx)的主要内容,如果未能解决你的问题,请参考以下文章

如何在 laravel 5.3 + VueJs Routes 中导入外部组件

Laravel 5.3:缺少参数 2

Laravel 5.3 - InvalidArgumentException 视图 [索引] 未找到 [重复]

laravel-5.3 路由配置

Laravel 5.3:布局视图中的路由

缁堜簬鏉ヤ簡锛佺粨鍚?Laravel 5.3 + vue 2.1 缁勪欢鍖栧紑鍙戠殑鍗氬绯荤粺