I know this issue has been discussed several times but I had no luck and I couldn't fix the issue.
I am going to run multiple Rails apps on AWS EC2 Instance with Unicorn and Nginx.
I could run one rails app on mydomain.com
So the project will be on mydomain.com/app1 and mydomain.com/app2
Projects are in /home/ubuntu/work/app1 and /home/ubuntu/work/app2
/etc/nginx/sites-available/default
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;
}
The error I am getting now. (Looks like the internal errors)
We're sorry, but something went wrong.
If you are the application owner check the logs for more information.
I have checked these files to check logs.
/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
But I can't find any log in nginx.error.log
And there were just warning in 2 unicorn.stderr.log
files.
There were not any errors.
Anyone can help me?