2015-12-15 106 views
0

我剛剛使用完NginxgunicornAmazon EC2上設置我的應用程序。當我在亞馬遜的IP地址類型:54.218.54.156,應用程序顯示了罰款和花花公子,但是當我使用公共DNS:ec2-54-218-54-156.us-west-2.compute.amazonaws.com我從Nginx以下信息...


enter image description here使用Amazon EC2:IP地址工作正常,但公共DNS不

我的網站,提供文件看起來像這樣...

server { 
    listen 80; 
    server_name 54.218.54.156; 

    location = /favicon.ico { access_log off; log_not_found off; } 
    location /static/ { 
    root /home/ubuntu/flowershop; 
    } 

    location/{ 
     include proxy_params; 
     proxy_pass http://unix:/home/ubuntu/flowershop/flowershop.sock; 
    } 
} 

我正在使用django並在virtualenv之內執行此操作如何進一步進行配置?

+0

爲什麼選擇投票? –

回答

1

有很多可能的問題。最重要的是查看你的日誌文件中的nginx(不太可能在這種情況下,b/c nginx似乎服務正常)以及gunicorn /你正在使用的其他WSGI/HTTP服務器。

在你的情況,我認爲這個問題是你要替換:

server_name 54.218.54.156; 

server_name ec2-54-218-54-156.us-west-2.compute.amazonaws.com 

基本服務器名通常應該是你要指向的網址:www.yourdomain。比如說com。

+0

謝謝,布魯。那樣做了! –