访问 CentOS69 服务器 Laravel 项目失败,nginx 配置问题吗?
ESC云服务器安装centos6.9,配置了PHP环境,
直接访问域名 例如 www.blog.com 是可以看到laravel的welcome页,
安装laravel-admin后,访问www.blog.com/admin 就提示
File not found.
是因为nginx没配置好吗?麻烦看下我的配置,哪里有问题,谢谢。
以下是位于 centos6.9 /etc/nginx/conf.d/virtual.conf 的配置
server {
listen 80 default_server;
#listen [::]:80 default_server;
server_name www.blog.com;
root /usr/share/nginx/html/blog/public;
#root /usr/share/nginx/html;
location / {
try_files $uri /app.php$is_args$args;
rewrite ^/$ /index.php last;
rewrite ^/(?!index\.php|robots\.txt|static)(.*)$ /index.php/$1 last;
index index.html index.htm index.php app.php;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_split_path_info ^(.+\.php)(/.+)$;
#fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
#fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
推荐文章: