2015-03-25 42 views
1

這種情況有些難以描述。我使用nginx和uwsgi在我的VPS上部署我的Django博客,它功能很好,但我只能使用我的IP訪問應用程序,如何在沒有www的情況下使用我的域來設置我的應用程序?我設置了服務器名稱breakwire.me並設置A記錄HOST是「@」,點到我的VPS的IP,但如果我訪問breakwire.me,我只能看到如何將我的godaddy域用於我的Django應用程序

「歡迎使用nginx的」

這裏是我的nginx的conf

# my_blog__nginx.conf 
# configuration of the server 
server { 
    the port your site will be served on 
    listen  106.186.29.228:8000; 
    # the domain name it will serve for 
    server_name breakwire.me; # substitute your machine's IP address or FQDN 
    charset  utf-8; 

    # max upload size 
    client_max_body_size 75M; # adjust to taste 

    # logs 
    access_log /home/chen/DjangoProjects/my_blog/logs/access.log; 
    error_log /home/chen/DjangoProjects/my_blog/logs/error.log; 

    # Django media 
    location /media { 
    alias /home/chen/DjangoProjects/my_blog/media; # your Django project's media files - amend as required 
    } 

    location /static { 
    alias /home/chen/DjangoProjects/my_blog/static; # your Django project's static files - amend as required 
    } 

    # Finally, send all non-media requests to the Django server. 
    location/{ 
    uwsgi_pass 106.186.29.228:8001; 
    include  /home/chen/DjangoProjects/my_blog/uwsgi_params; # the uwsgi_params file you installed 
    } 
} 

回答

1

更改

聽106.186.29.228:8000

聽106.186.29.228

或:106.186.29.228:80

的瀏覽器總是連接端口80上的nginx的虛擬服務器正在監聽在端口8000上,所以如果你試圖用http://breakwire.me:8000/ 打開你的網站,它的工作原理是因爲你已經在listen指令中將端口設置爲8000。

+0

如果我不想讓用戶使用默認端口80,該如何配置? – 2015-03-25 12:23:31

+0

你的意思是域名應該指向端口8000本身,而不單獨指定?我想這是不可能的。 – pushrbx 2015-03-25 13:36:18

+0

非常感謝! – 2015-03-26 10:16:55

相關問題