我知道这个问题已经讨论过好几次了,但我没有运气,无法解决这个问题。
我要去运行多个 Rails 应用程序在AWS EC2 实例和独角兽和Nginx。
我可以运行一个 Rails 应用程序我的域名
因此项目将在mydomain.com/app1和mydomain.com/app2
项目正在/主页/ubuntu/工作/app1和/主页/ubuntu/工作/app2
/etc/nginx/站点可用/默认
upstream app1 {
server unix:/home/ubuntu/work/app1/shared/sockets/unicorn.sock fail_timeout=0;
}
upstream app2 {
server unix:/home/ubuntu/work/app2/shared/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name localhost;
root /home/ubuntu/work;
access_log /home/ubuntu/work/log/nginx.access.log;
error_log /home/ubuntu/work/log/nginx.error.log;
location /app1/ {
root /home/ubuntu/work/app1/public;
rewrite ^/app1/(.*)$ /$1 break;
try_files /app1/$uri/index.html /app1/$uri.html /app1/$uri @app1;
}
location /app2/ {
root /home/ubuntu/work/app2/public;
rewrite ^/app2/(.*)$ /$1 break;
try_files /app2/$uri/index.html /app2/$uri.html /app2/$uri @app2;
}
location @app1 {
proxy_pass http://app1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
}
location @app2 {
proxy_pass http://app2;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
我现在遇到的错误。(看起来像是内部错误)
We're sorry, but something went wrong.
If you are the application owner check the logs for more information.
我已检查这些文件来检查日志。
/home/ubuntu/work/log/nginx.error.log
/home/ubuntu/work/fastland1/shared/log/unicorn.stderr.log
/home/ubuntu/work/fastland2/shared/log/unicorn.stderr.log
但我找不到任何登录信息nginx.error.log
并且 2 个文件中只有警告unicorn.stderr.log
。没有任何错误。
有人能帮助我吗?