Laravel nginx.conf与官方Heroku php构建包?
在我的项目根目录中,`nginx.conf中有以下内容Laravel nginx.conf与官方Heroku php构建包?,laravel,heroku,nginx,Laravel,Heroku,Nginx,在我的项目根目录中,`nginx.conf中有以下内容 location / { try_files $uri $uri/ /index.php?$query_string; } 但是只有在/路径工作时,所有其他路径都会出现404错误 如何使用nginx让Laravel在heroku上工作?您缺少fastcgi.*指令;在您的位置指令后尝试此操作: location ~ \.php$ { try_files $uri /index.php =404; fastcg
location / {
try_files $uri $uri/ /index.php?$query_string;
}
但是只有在/
路径工作时,所有其他路径都会出现404错误
如何使用nginx让Laravel在heroku上工作?您缺少
fastcgi.*
指令;在您的位置
指令后尝试此操作:
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;
}
来源:这最终对我有效: 程序文件:
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;
}
这是不正确的,在Heroku上不起作用,因为没有
unix:/var/run/php5 fpm.sock
socket-它位于不同的位置(默认配置提供了命名的上游和您可以使用的命名位置,因此您的本地配置永远不会绑定到确切的位置,因此在更改时不会中断)。如果答案不适用于问题,请不要盲目地从文档中复制/粘贴答案。Heroku不是一个普通的Ubuntu 14.04服务器。谢谢!这对我的安装也起到了作用。您是将nginx.conf文件放在根目录下还是公共目录下folder@user3666882这已经有一段时间了,但我相当肯定这一定是根dirWorks伟大的与Heroku和Laravel 5.5