I'm trying to make nginx proxy requests to a Django server, but it keeps showing the nginx welcome page.
Here's /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;
}
}
and here's /etc/nginx/sites-enabled/dotmanca
(the only file in the site-enabled
directory):
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"';
}
}
So with no server running on port 8001, I expect a bad gateway error to show up. Instead I see the default "Welcome to nginx!"
Running sudo nginx -t
gives the following:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Also, sudo service nginx restart
appears to do nothing.
My nginx version is 1.4.6, and it's running on Ubuntu Trusty.