2013-10-01 87 views
0

我已經在linode上使用unicorn和nginx設置和部署了一個rails應用程序。但是,當我轉到我在sites-enabled中設置的應用程序配置中設置的URL時,我可以使用在端口80上偵聽的默認站點。 如果我知道IP和端口,我什麼都沒有。 如果我將該網站設置爲在80上進行收聽,它會正常工作Nginx不監聽指定端口

URL從註冊器指向linode IP並且工作正常。在

xxxx.co.uk文件站點啓用,

upstream unicorn 
    server unix:/tmp/unicorn.xxxx.co.uk.sock fail_timeout=0; 
} 

server { 
    server_name xxxx xxxx; 
    listen 3001 default deferred; 
    root /var/www/apps/nocn.org.uk/current/public; 

    location ^~ /assets/ { 
    gzip_static on; 
    #try $uri /old$uri 
    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; 
} 
+1

您是否已啓用對linode防火牆或配置中的端口3001的遠程訪問? – akhanubis

+0

不,那正是問題所在,隨時提交它作爲答案,我會接受。雖然 – RyanMacG

回答

1

確保您啓用了的Linode的防火牆或配置端口3001的遠程訪問(通過使用iptables的可能)。

+0

只是將iptables設置爲允許80和443,但server_name中指定的URL仍然被默認站點捕獲,但它仍然忽略了備用URL – RyanMacG