使用Laravel的Nginx HHVM返回404 File Not Found

时间:2015-02-08 22:52:23

标签: laravel nginx hhvm

我刚刚在debian机器上设置了HVVM。我的问题是,当我访问laravel路由时,它返回这个奇怪的消息:404 File Not Found,但是,如果我在laravel的公共目录中创建一个新的.php文件,一切都安全可靠。这是我的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;
 }
}

那可能是错的?

1 个答案:

答案 0 :(得分:-2)

嗯,在我的情况下,问题是nginx块配置。

更换:

location / {
                    try_files $uri $uri/ index.php?$query_string;
            }

使用:

 location / {
        try_files \$uri \$uri/ /index.php?\$query_string;
    }

做了这个伎俩。