nginx配置laravel
异常日志:
sudo gedit /var/log/nginx/error.log
sudo service nginx restart
sudo gedit /etc/nginx/sites-available/default
4.2配置
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
# 设定网站根目录
root /var/www/laravel/public;
# 网站默认首页
index index.php index.html index.htm;
# 服务器名称,server_domain_or_IP 请替换为自己设置的名称或者 IP 地址
server_name localhost;
# 修改为 Laravel 转发规则
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# PHP 支持
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
5.0:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/laravel/learnlaravel5/public;
index index.html index.htm index.php;
# Make site accessible from http://localhost/
server_name localhost;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# Pass all .php files onto a php-fpm/php-fcgi server.
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
}
文章来源: blog.csdn.net,作者:网奇,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/jacke121/article/details/55548934
- 点赞
- 收藏
- 关注作者
评论(0)