在 / etc/nginx/conf.d 下新建一个 Laravel.conf 文件, 并编辑
写入如下文件即可
- server {
- listen 80;
- server_name xxx;
- root "/www/public";
- location / {
- index index.html index.htm index.PHP;
- if (-f $request_filename/index.HTML){
- rewrite (.*) $1/index.HTML break;
- }
- #if (-f $request_filename/index.PHP){
- # rewrite (.*) $1/index.PHP;
- #}
- #if (!-f $request_filename){
- # rewrite (.*) /index.PHP;
- #}
- if (!-e $request_filename) {
- rewrite ^(.*)$ /index.PHP?s=/$1 last;
- }
- }
- error_page 404 403 500 502 503 504 /404.HTML;
- location = /404.HTML {
- root /;
- }
- location ~ \.PHP$ {
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.PHP;
- fastcgi_split_path_info ^((?U).+\.PHP)(/?.+)$;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_param PATH_INFO $fastcgi_path_info;
- fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
- include fastcgi_params;
- }
- }
来源: http://www.bubuko.com/infodetail-3338780.html