0
laravel5.2,nginx 1.10 windows環境。拉拉維爾家是工作任何其他路線不工作。請幫助我解決這個問題。我如何在nginx.conf中設置url重寫來正確工作。下面是我的配置。laravel 5.2 nginx 1.10只有windows的主頁正在工作
此配置中缺少的是什麼。請檢查並提供解決方案。
code
server {
listen 85;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location/{
root D:\Nginx1103\html;
index index.html index.htm index.php;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~* \.php$ {
fastcgi_intercept_errors on;
try_files $uri =404;
# root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param SCRIPT_FILENAME D:\Nginx1103\html\valeroo$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
這是我更新的代碼
server {
listen 85;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
root D:\Nginx1103\html;
location/{
try_files $uri $uri/ /index.html;
autoindex off;
if (!-f $request_filename) {
rewrite /(.*)$ /index.php last;
break;
}
}
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
access_log off;
log_not_found off;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
location ~* \.(?:ico|css|js|jpe?g|JPG|png|svg|woff)$ {
expires 365d;
}
}
不工作。顯示404未找到錯誤。 – juni
@juni更新了我的答案,現在檢查,取自真實應用 – num8er
同樣的錯誤404 Not Found – juni