We have hosted Django application on NGINX in EC2 private subnet, we are not able to access it via AWS application load balancer end point. Below is the configuration file from location /etc/nginx/sites-enabled/myserver.conf
We are getting 504 Gateway timeout
using port 80 in configuration file and 502 bad Gateway
using 443 in configuration file.
upstream my_server {
#server 0.0.0.0:80;
server unix:/home/ubuntu/Desktop/star/star.sock fail_timeout=0;
}
server {
listen 443; # default_server
server_name 0.0.0.0;
client_max_body_size 4G;
access_log /home/ubuntu/Desktop/star/logs/nginx-access.log;
error_log /home/ubuntu/Desktop/star/logs/nginx-error.log;
location /static/ {
root /home/ubuntu/Desktop/star/dashboard/static/;
}
location / {
proxy_hide_header X-Frame-Options;
include proxy_params;
proxy_pass http://unix:/home/ubuntu/Desktop/star/star.sock;
}
# Error pages
error_page 500 502 503 504 /500.html;
location = /500.html {
root /home/ubuntu/Desktop/star/dashboard/static/;
}
location ^~ /(css|js) {
root /home/ubuntu/Desktop/star/dashboard/static/;
}
}
server {
if ($host = 0.0.0.0) {
return 301 https://$host$request_uri;
}
if ($host = 0.0.0.0) {
return 301 https://$host$request_uri;
}
listen 443;
server_name 0.0.0.0;
return 404;
}