Laravel 返回 404 找不到文件的 Nginx HHVM
Nginx HHVM with Laravel returning 404 File Not Found
我刚刚在 debian 机器上设置了 HVVM。我的问题是,当我访问 laravel 路由时 returns 这个奇怪的消息: 404 File Not Found ,但是,如果我在 public 中创建一个新的 .php 文件laravel 的目录,一切正常。这是我的 nginx 和 hhvm conf 文件:
hhvm.conf:
location ~ \.(hh|php)$ {
fastcgi_keep_conn on;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
nginx配置:
server {
# Make site accessible from http://localhost/
server_name ***;
gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# Disable for IE < 6 because there are some known problems
gzip_disable "MSIE [1-6].(?!.*SV1)";
# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
gzip_vary on;
listen 80 default_server;
root /var/www/***/public_html/laravel/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ index.php?$query_string;
}
include hhvm.conf;
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}
}
那么可能出了什么问题?
嗯,在我的例子中,问题是 nginx 块配置。
正在替换:
location / {
try_files $uri $uri/ index.php?$query_string;
}
与:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
成功了。
我刚刚在 debian 机器上设置了 HVVM。我的问题是,当我访问 laravel 路由时 returns 这个奇怪的消息: 404 File Not Found ,但是,如果我在 public 中创建一个新的 .php 文件laravel 的目录,一切正常。这是我的 nginx 和 hhvm conf 文件:
hhvm.conf:
location ~ \.(hh|php)$ {
fastcgi_keep_conn on;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
nginx配置:
server {
# Make site accessible from http://localhost/
server_name ***;
gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# Disable for IE < 6 because there are some known problems
gzip_disable "MSIE [1-6].(?!.*SV1)";
# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
gzip_vary on;
listen 80 default_server;
root /var/www/***/public_html/laravel/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ index.php?$query_string;
}
include hhvm.conf;
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}
}
那么可能出了什么问题?
嗯,在我的例子中,问题是 nginx 块配置。
正在替换:
location / {
try_files $uri $uri/ index.php?$query_string;
}
与:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
成功了。