0
我試圖讓nginx代理請求到Django服務器,但它一直顯示nginx歡迎頁面。nginx始終提供歡迎頁面
這裏的/etc/nginx/nginx.conf
:
worker_processes 4;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile off;
tcp_nopush on;
keepalive_timeout 65;
gzip on;
gzip_disable "msie6";
include /etc/nginx/sites-enabled/*;
server {
listen 8000 default_server;
listen [::]:8000 default_server ipv6only=on;
}
}
和這裏的/etc/nginx/sites-enabled/dotmanca
(在site-enabled
目錄中唯一的文件):
server {
server_name _;
access_log off;
location /media/ {
alias /vagrant/media/;
}
location /static/ {
alias /vagrant/static/;
}
location/{
proxy_pass http://127.0.0.1:8001;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
}
}
沒有服務器在端口8001上運行
於是,我想到一個壞網關錯誤出現。相反,我看到默認的「歡迎使用nginx!」
運行sudo nginx -t
給出如下:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
此外,sudo service nginx restart
顯得無能爲力。
我的nginx版本是1.4.6,它在Ubuntu Trusty上運行。