首页 > 系统服务 > 详细

Ubuntu 17 Nginx 配置 laravel 运行环境

时间:2018-04-10 10:06:57      阅读:189      评论:0      收藏:0      [点我收藏+]

1 安装 nginx

#aptitude install nginx

#apatitude install php7.1-fpm

2 在 /etc/nginx/sites-available 建立 semis.conf 如下:

server {
         listen 80;
         listen [::]:80;

        server_name semis.test;

        root /var/www/app/semis/webroot/public;
         index index.php;

        location / {
                 #try_files $uri $uri/ =404;
                 try_files $uri $uri/ /index.php?$query_string;
         }

        location ~ \.php$ {
                 include snippets/fastcgi-php.conf;
                 fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
         }

}

3 如果 Laravel 是5.5 版本,可以不加下页这行(估计是 public/.htaccess 文件生效了)

try_files $uri $uri/ /index.php?$query_string;

Ubuntu 17 Nginx 配置 laravel 运行环境

原文:https://www.cnblogs.com/mouseleo/p/8776452.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!