我一直在努力让这项工作持续数小时。我刚刚获得404s这是我目前为我的nginx.conf文件所拥有的:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 127.0.0.1;
server_name localhost;
root /laravel/public;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
# root /laravel/public;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
# root /laravel/public;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME C:/nginx/laravel/public$fastcgi_script_name;
include fastcgi_params;
}
location ~* \.(?:ico|css|js|gif|jpg|jpeg|png)$ {
# root /laravel/public;
try_files $uri =404;
}
}
}
我检查了以下内容,但这些路径都不起作用:
http://localhost/laravel/public/img/apple.png
http://localhost/public/img/apple.png
http://localhost/img/apple.png
http://localhost/apple.png
我无法弄清楚为什么这不起作用。一些帮助将不胜感激。
编辑:我正在使用nginx版本1.10.2
编辑:错误日志中没有任何内容,并在访问日志中获取以下内容:
127.0.0.1 - - [12/Dec/2016:19:54:44 -0800] "GET / HTTP/1.1" 200 4482 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"
127.0.0.1 - - [12/Dec/2016:19:54:44 -0800] "GET /css/raw.min.css HTTP/1.1" 404 571 "http://localhost" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"
127.0.0.1 - - [12/Dec/2016:19:54:44 -0800] "GET /css/app.css HTTP/1.1" 404 571 "http://localhost" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"
127.0.0.1 - - [12/Dec/2016:19:54:44 -0800] "GET /js/app.js HTTP/1.1" 404 571 "http://localhost" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"
127.0.0.1 - - [12/Dec/2016:19:54:44 -0800] "GET /img/apple.png HTTP/1.1" 404 571 "http://localhost" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"
127.0.0.1 - - [12/Dec/2016:19:54:44 -0800] "GET /js/app.js HTTP/1.1" 404 571 "http://localhost" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"