gunicorn - how to serve index page from django instead of nginx static index page option -
i trying deploy webapp using nginx-gunicorn-djngo.the problem when open root url(eg. www.xyz.com) in browser shows default welcome page of nginx want serve index page through django using proxy_pass.
when opening www.xyz.com// works fine url matches location block wiht pattern "/".please suggest how can make nginx redirect www.xyz.com gunicorn server.
find below nginx.conf
user ec2-user; worker_processes auto; error_log /var/log/nginx/error.log; #error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; #keepalive_timeout 0; keepalive_timeout 65; types_hash_max_size 2048; #gzip on; include /etc/nginx/conf.d/*.conf; upstream agencyhunt_server { server unix:/home/ec2-user/xyz/xyz.sock; fail_timeout=10s; } server { listen 80; server_name www.taskuse.com; client_max_body_size 4g; access_log /home/ec2-user/agencyhunt/logs/nginx-access.log; error_log /home/ec2-user/agencyhunt/logs/nginx-error.log warn; location = /favicon.ico { access_log off; log_not_found off; } location / { proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header host $http_host; proxy_redirect off; proxy_pass http://unix:/home/ec2-user/xyz/xyz.sock; } error_page 404 /404.html; location = /40x.html { } }
Comments
Post a Comment