skip to Main Content

I’m trying to setup an app on my Digital Ocean production server, I’ve followed these instructions, testing gunicorn and nginx,I could access the app in gunicorn and both services start fine with no errors logged. However when I go to the site it does not show anything. This is a subdomain of my main site. Mostly I’m looking to find a place to start troubleshooting this especially since everything looks fine.

Configs:

Nginx config for subdomain (Django) site:

server {
  # use 'listen 80 deferred;' for Linux
  # use 'listen 80 accept_filter=httpready;' for FreeBSD
  listen 80;

  # set the correct host(s) for your site
  server_name subdomain.domain_name.com www.subdomain.domain_name.com;

  location = /favicon.ico {access_log off; log_not_found off;}
  location /static/ {
    root /path/to/static/files;
  }

  location / {
    include proxy_params;
    proxy_pass http://unix:/path/to/.sock/file;
  }

}

Nginx config for main (static) site:

server {
        listen 80 default_server;
        listen [::]:80 default_server;


        root /var/www/main_site_folder;

    index index.html index.htm index.nginx-debian.html;

        server_name domain_name www.domain_name;

        location / {
        try_files $uri $uri/ =404;
        }

}

[Unit]
Description=Description of the app
After=network.target

[Service]
User=MyUserName
Group=www-data
WorkingDirectory=/var/www/app_directory/
ExecStart=/path/to/venv/and/gunicorn --access-logfile - --workers 3 --bind unix:/var/www/app_dir/.sock_filename app_name.wsgi:application

[Install]
WantedBy=multi-user.target

2

Answers


  1. Chosen as BEST ANSWER

    Solved by adding an A record for the sub-domain 🙄, this was a classic case of not being able to find the answer because it was right in front of my face. 😅


  2. You could start by changing ALLOWED_HOSTS = ["*"] in settings.py. Also try accessing your URL through CURL.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search