我已經在我的Windows機器上安裝了nginx,並且我做了一個新的laravel安裝。我創建了新的路線,但沒有其他路線,除了根部工作。我收到一個404錯誤。Nginx的Windows Laravel路由不工作
錯誤日誌說
「的CreateFile() 「C:\ nginx的/ HTML /的Myproj /公/註冊」 失敗(2: 系統找不到指定的文件),客戶端:127.0。 0.1,服務器: 本地主機,請求: 「GET /遊艇/公/註冊HTTP/1.1」,主持人: 「localhost」 的」
下面是我的Nginx \的conf \ nginx.conf文件。
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location/{
root 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$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location/{
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location/{
# root html;
# index index.html index.htm;
# }
#}
}
請提出任何想法來解決這個問題。
解釋「除了根以外的其他路線似乎工作_」的意思是有幫助的。你做了什麼;你期望會發生什麼;究竟發生了什麼,你沒有想到?這些是你必須提供給我們的三件事才能理解問題。 – Sherif
編輯我的帖子。請檢查。 –
不幸的是,「_it沒有工作_」和「_I做了一件未知的事情,導致了通用錯誤_」並不是有用的度量標準,用於縮小這裏可能出現錯誤的可能列表。您需要檢查您的nginx錯誤日誌,並實際查找有關爲什麼服務器爲給定的URI返回404找不到HTTP狀態碼的更詳細的錯誤信息。否則,提供可能導致這種一般性錯誤的1001件事情的清單是毫無意義的。 – Sherif