title: Gunicorn not creating .sock file on AWS EC2
body: <p>I'm stuck with creating a Django web app following this tutorial:
  <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04#check-for-the-gunicorn-socket-file" rel="nofollow noreferrer">https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04#check-for-the-gunicorn-socket-file</a></p>
  
  <p>I think I've read all related questions on SO:</p>
  
  <p><a href="https://stackoverflow.com/questions/39919053/django-gunicorn-sock-file-not-created-by-wsgi">django gunicorn sock file not created by wsgi</a></p>
  
  <p><a href="https://stackoverflow.com/questions/47244074/gunicorn-not-generating-sock-file">Gunicorn not generating sock file</a></p>
  
  <p><a href="https://github.com/benoitc/gunicorn/issues/1166" rel="nofollow noreferrer">https://github.com/benoitc/gunicorn/issues/1166</a></p>
  
  <p>None of them helped.</p>
  
  <p>I'm following each step exactly as described but still the myapp.sock file is not created.</p>
  
  <p>The main project directory is <code>/home/ubuntu/puchalatravel</code>
  It's content:</p>
  
  <pre><code>ubuntu@ip-172-31-35-104:~/puchalatravel$ ls -l
  total 60
  -rw-r--r-- 1 ubuntu ubuntu   40960 Sep  4 09:37 db.sqlite3
  -rwxrwxr-x 1 ubuntu ubuntu     545 Sep  4 07:42 manage.py
  drwxrwxr-x 3 ubuntu www-data  4096 Sep  4 09:32 puchalatravel
  drwxrwxr-x 4 ubuntu ubuntu    4096 Sep  4 07:41 puchalatravelenv
  drwxrwxr-x 3 ubuntu ubuntu    4096 Sep  4 09:34 static
  </code></pre>
  
  <p>Access to the folder:</p>
  
  <pre><code>ubuntu@ip-172-31-35-104:~$ ls -l
  total 1616
  drwxrwxr-x 4 ubuntu ubuntu      4096 Aug 30 07:25 eb-virt
  -rw-rw-r-- 1 ubuntu ubuntu   1642522 Aug 30 07:11 get-pip.py
  drwxrwxr-x 6 ubuntu www-data    4096 Sep  4 09:37 puchalatravel
  </code></pre>
  
  <p>Content of <code>/etc/systemd/system/gunicorn.service</code></p>
  
  <pre><code>[Unit]
  Description=gunicorn daemon
  After=network.target
  
  [Service]
  User=ubuntu
  Group=www-data
  WorkingDirectory=/home/ubuntu/puchalatravel
  ExecStart=/home/ubuntu/puchalatravel/puchalatravelenv/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/puchalatravel/puchalatravel.sock puchalatravel.wsgi:application
  
  [Install]
  WantedBy=multi-user.target
  </code></pre>
  
  <p>Content of <code>/etc/nginx/sites-available/puchalatravel</code></p>
  
  <pre><code>server {                                                                                                                                                                                                                                 sserver {
  listen 8000;
      server_name ec2-18-188-249-6.us-east-2.compute.amazonaws.com;
  
      location = /favicon.ico { access_log off; log_not_found off; }
      location /static/ {
          root /home/ubuntu/puchalatravel;
      }
  
      location / {
          include proxy_params;
          proxy_pass http://unix:/home/ubuntu/puchalatravel/puchalatravel.sock;
      }
  }
  </code></pre>
  
  <p>I've ran</p>
  
  <pre><code>pkill gunicorn
  sudo systemctl daemon-reload
  sudo systemctl start gunicorn
  sudo systemctl enable gunicorn
  sudo systemctl restart nginx
  </code></pre>
  
  <p>Several times, no effect whatsoever.</p>
  
  <p>Output of <code>sudo systemctl status gunicorn</code></p>
  
  <pre><code>● gunicorn.service - gunicorn daemon
  Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled)
  Active: failed (Result: exit-code) since Tue 2018-09-04 09:56:51 UTC; 18min ago
  Main PID: 19906 (code=exited, status=1/FAILURE)
  
  Sep 04 09:56:46 ip-172-31-35-104 gunicorn[19906]: [2018-09-04 09:56:46 +0000] [19906] [INFO] Starting gunicorn 19.9.0
  Sep 04 09:56:46 ip-172-31-35-104 gunicorn[19906]: [2018-09-04 09:56:46 +0000] [19906] [ERROR] Retrying in 1 second.
  Sep 04 09:56:47 ip-172-31-35-104 gunicorn[19906]: [2018-09-04 09:56:47 +0000] [19906] [ERROR] Retrying in 1 second.
  Sep 04 09:56:48 ip-172-31-35-104 gunicorn[19906]: [2018-09-04 09:56:48 +0000] [19906] [ERROR] Retrying in 1 second.
  Sep 04 09:56:49 ip-172-31-35-104 gunicorn[19906]: [2018-09-04 09:56:49 +0000] [19906] [ERROR] Retrying in 1 second.
  Sep 04 09:56:50 ip-172-31-35-104 gunicorn[19906]: [2018-09-04 09:56:50 +0000] [19906] [ERROR] Retrying in 1 second.
  Sep 04 09:56:51 ip-172-31-35-104 gunicorn[19906]: [2018-09-04 09:56:51 +0000] [19906] [ERROR] Can't connect to /home/puchalatravel/puchalatravel.sock
  Sep 04 09:56:51 ip-172-31-35-104 systemd[1]: gunicorn.service: Main process exited, code=exited, status=1/FAILURE
  Sep 04 09:56:51 ip-172-31-35-104 systemd[1]: gunicorn.service: Unit entered failed state.
  Sep 04 09:56:51 ip-172-31-35-104 systemd[1]: gunicorn.service: Failed with result 'exit-code'.
  </code></pre>
  
  <p>Could this be related to AWS EC2 setup? Gunicorn works to serve the page directly to port 8000 but not via the socket as it's not created.</p>