I'm trying to follow the Nginx setup steps in Chapter 8, but doing it on CentOS 7. I've done it correctly before on Ubuntu on AWS and it worked. So far I had no luck on CentOS 7 (it's actually running on VirtualBox locally with all the port forwarding setup correctly), I also tried following the tutorial in DigitalOcean
https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-on-centos-7. I set up the proxy_pass, but it doesn't seem like the requests are being passed to Django when I have runserver running.
Nginx (nginx.conf):
[...]
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
include /etc/nginx/sites-enabled/*.conf;
server_names_has_bucket_size 64;
}
sites-available (project-staging.conf):
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://localhost:8000;
}
}
sites-enabled (project-staging.conf):
projmgmt-staging.centos.conf -> /etc/nginx/sites-available/projmgmt-staging.centos.conf
On the host system, I can open up the page and I still see the default Nginx welcome page. I'm wondering if the default server block (before my include for sites-enabled) takes precedence. When I shift things around, it doesn't really change the behavior. When I play with the ports to use something other than Port 80, I get a Bad Gateway message.
If I change the nginx.conf file's default server block to specify the proxy_pass in the location to my Django runserver, it gives me the default Nginx error page.
Any suggestions on how to trace what's going on?