4
我已经能够使用nginx,独角兽和capistrano将虚拟主机应用部署到vps系统中,没有任何错误。现在,我想在同一个vps服务器内使用相同的nginx配置(下面的两个脚本)部署另一个rails应用程序,并在运行cap deploy之后:setup和cap deploy:冷却它正确设置并且rails应用程序被发送到服务器。我得到的问题是这个。当我键入service nginx restart
我得到以下错误设置独角兽,nginx和capistrano的虚拟主机在轨道上
nginx: [emerg] duplicate upstream "unicorn" in /etc/nginx/sites-enabled/cf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
我对当前正在运行的第一个应用程序nginx的脚本是
upstream unicorn {
server unix:/tmp/unicorn.cf.sock fail_timeout=0;
}
server {
listen 80 default deferred;
server_name cfmagazineonline.com;
root /home/deployer/apps/cf/current/public;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
第二轨应用程序,它运行失败,而是trows我nginx的配置第一个错误Rails应用程序,并使其崩溃是
upstream unicorn {
server unix:/tmp/unicorn.gutrees.sock fail_timeout=0;
}
server {
listen 80 default deferred;
server_name gutrees.com;
root /home/deployer/apps/gutrees/current/public;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
任何想法如何,我可以解决这个问题,并成立了虚拟主机正确。谢谢
不错。这修正了第一个错误。新错误是'nginx:配置文件/etc/nginx/nginx.conf测试失败'。我还将第二个应用程序的@unicorn变量更新为@gutrees。我想这个吗? – Uchenna
第二个错误在部署到服务器后仍然出现,当我输入第一个应用程序运行它的URL时崩溃 – Uchenna