python - Connection error with Gunicorn / Nginx -
i learning nginx , configuring nginx.conf gunicorn. running gunicorn on port 8000 , nginx listening on port 80. works fine, gives "unable connect" error.
here nginx.conf file
user www-data; worker_processes auto; pid /run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # basic settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ssl_protocols tlsv1 tlsv1.1 tlsv1.2; # dropping sslv3, ref: poodle ssl_prefer_server_ciphers on; ## # logging settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # gzip settings ## gzip on; gzip_disable "msie6"; # gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
i have supervisor config file: here supervisor config file
[program:python-activate] directory=<path of directory> command=/home/ashiyap/ianp3.sh gunicorn proj.wsgi:application -b 0.0.0.0:8000 autostart=true autorestart=true stderr_logfile=/var/log/supervisor.err.log stdout_logfile=/var/log/supervisor.out.log
here nginx python conf file
server { # port site served on listen 80; # domain name serve server_name <ipaddress>; # substitute fqdn , machine's ip address charset utf-8; #max upload size client_max_body_size 75m; # adjust taste # django media location /media { root /home/ashiyap/test/wp005_v02.00.00.d2_itr1/proj; # django project's media files autoindex off; } location /static { root /home/ashiyap/test/wp005_v02.00.00.d2_itr1/proj; # django project's static file autoindex off; } # finally, send non-media requests django server. location / { proxy_pass http://<ipaddress>:8000; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; } }
Comments
Post a Comment