简体   繁体   中英

django nginx gunicorn application showing apache2 default page - only on ip request not domain name

Very odd behavior from my Ubuntu 18.04 LTS server

I have followed this tutorial here (twice) and it is all working properly except a couple odd things

firstly, when I use my browser to visit the IP of my VPS, the django default application page shows up throughout the tutorial however accessing it through the domain name results in a time out error

secondly, now that I have completed the tutorial and configured nginx to proxy pass to gunicorn, the apache2 ubuntu default page is now displaying instead of the django default page on a visit to the ip address and still no response from the domain name, even though there is no installation of apache2 on this server...

$ whereis apache2
apache2:

here is my gunicorn.socket file

[Unit]
Description=gunicorn socket

[Socket]
ListenStream=/run/gunicorn.sock

[Install]
WantedBy=sockets.target

here is my gunicorn.service file

[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target

[Service]
User=trends
Group=www-data
WorkingDirectory=/trends_dir
ExecStart=/trends_dir/trendsvenv/bin/gunicorn \
          --access-logfile - \
          --workers 3 \
          --bind unix:/run/gunicorn.sock \
          trends.wsgi:application

[Install]
WantedBy=multi-user.target

here is my /etc/nginx/sites-available config file for the site, which has been properly symlinked to /etc/nginx/sites-enabled

server {
    listen 80;
    server_name www.trendsontheblock.com trendsontheblock.com;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /trends_dir;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/run/gunicorn.sock;
    }
}

like i said, no errors from the ip address and cannot get a response from the domain name, any help would be greatly appreciated, thank you

As pointed out by Mohamed in the comments section the error was due to incorrect ip-domain mapping caused by an inconsistent A record value in my domain name hosting service (godaddy)

This was because I had switched from shared hosting to VPS and the domain name's name-server values had therefore become inconsistent

The domain-name server needed to be reset to the default host values and it's A record was updated to the new VPS server's IP this has solved my issue

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM