server {
listen 8080;
server_name laravel.localhost;
client_max_body_size 10M;
# Load configuration files for the default server block.
location / {
root D://robin-admin/public;
index index.html index.htm index.php;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
root D://robin-admin/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
nginx 根目录指向laravel 的下的public 文件夹
try_files $uri $uri/ /index.php?$query_string; 可以有效重新访问后缀(不需要显式指明php后缀)