在使用带有rails应用程序的unicorn + nginx时,我需要帮助在同一服务器中设置一些根。
当我只设置根时,我的应用程序可以正常工作。
upstream contab_teste {
server unix:/home/ubuntu/apps/contab/shared/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name default_server;
rails_env production;
try_files $uri $uri/index.html @app;
root /home/ubuntu/apps/contab/public;
location @app {
proxy_pass http://contab_teste;
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;
}
当我设置另一个根目录时,它不起作用。 我尝试过某种方式这样做:
upstream contab_teste {
server unix:/home/ubuntu/apps/contab/shared/sockets/unicorn.sock fail_timeout=0;
}
upstream contab_apresentacao {
server unix:/home/ubuntu/apps/contab_apresentacao/shared/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name default_server;
rails_env production;
try_files $uri $uri/index.html @app;
root /home/ubuntu/apps/contab/public;
location @app {
proxy_pass http://contab_teste;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
}
location /apresentacao {
#rewrite ^/apresentacao(.*) /$1 break;
root /home/ubuntu/apps/contab_apresentacao/public;
proxy_pass http://contab_apresentacao;
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;
}
有人可以帮我吗? 谢谢!