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