我在我的项目根目录中的`nginx.conf中有以下内容
location / { try_files $uri $uri/ /index.php?$query_string; }
但只有在/
path工作,所有其他人都想出了一个404错误。
我怎样才能让Laravel和nginx一起在heroku上工作?
这最终为我工作:Procfile:
web: vendor/bin/heroku-php-nginx -C nginx.conf public/
nginx.conf
location / { # try to serve file directly, fallback to rewrite try_files $uri @rewriteapp; } location @rewriteapp { # rewrite all to app.php rewrite ^(.*)$ /index.php$1 last; }
你缺少fastcgi_*
指令; 在你的location
指令后试试这个:
location ~ \.php$ { try_files $uri /index.php =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
资料来源: 如何在Ubuntu 14.04上安装带有Nginx Web服务器的Laravel