Reputation: 19
I am setting up a production server with Angular serving the front end and Django on the back. I got Nginx serving Angular properly but any requests to the backend dont go through and just time out.
I have Nginx serving Angular on port 80 and then Django on port 8800
This is the code I have in place for Django
server {
listen 8800;
server_name ADDRESS;
location = /favicon.ico {access_log off;log_not_found off;}
location = /static/ {
root /home/ubuntu/django/dbsystem;
}
location = /media/ {
root /home/ubuntu/django/dbsystem;
}
location = / {
include proxy_params;
proxy_pass http://unix:/home/ubuntu/django/dbsystem/dbsystem.sock;
}
}
This is the code I have in place for Angular
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ /index.html;
}
}
This is the code for Gunicorn
[Unit]
Description=gunicorn service
After=network.target
[Service]
User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/django/dbsystem/
ExecStart=/home/ubuntu/django/bin/gunicorn --access-logfile - --workers 3 -- bind unix:/home/ubuntu/django/dbsystem/dbsystem.sock dbsystem.wsgi:application
[Install]
WantedBy=multi-user.target
Upvotes: 0
Views: 983
Reputation: 1340
There is a problem with location =
in you nginx configuration. Please remove =
and it would work.
Upvotes: 2