I wanted to that my dango app run in server and I tried with gunciron. When i run my app with gunicorn, server is working. I mean
`# gunicorn --bind 0.0.0.0:8000 myapp.wsgi`
is working
But if i disconnect with server, server is not working. So i used ngnix.
I followed this source https://github.com/satssehgal/URLShortnerDjango- . I did all them. I controlled my path but all path is right. What can i do for server work?
systemctl status nginx enter image description here
ps aux | grep php-fpm
ngnix.conf:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
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;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
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_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/javascript text/xml application/xml application/x$
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
}
/etc/nginx/sites-available/myapp:
server {
listen 80;
location = /favicon.ico { access_log off; log_not_found off; }
keepalive_timeout 10;
charset utf-8;
location /static/ {
root /root/ayzguci/myapp;
}
location / {
include proxy_params;
proxy_pass http://unix:/root/ayzguci/myapp/myapp.sock;
proxy_redirect off;
proxy_set_header X-Forwarded-Host $5.105.5.140;
}
}
ps ax|grep gunicorn outout:
1782 ? Ss 0:00 /root/ayzguci/myenv/bin/python3 /root/ayzguci/myenv/bin/gunicorn --access-logfile - --timeout 1000 --workers 3 --bind unix:/root/ayzguci/myapp/myapp.sock myapp.wsgi:application
1812 ? S 0:00 /root/ayzguci/myenv/bin/python3 /root/ayzguci/myenv/bin/gunicorn --access-logfile - --timeout 1000 --workers 3 --bind unix:/root/ayzguci/myapp/myapp.sock myapp.wsgi:application
1813 ? S 0:00 /root/ayzguci/myenv/bin/python3 /root/ayzguci/myenv/bin/gunicorn --access-logfile - --timeout 1000 --workers 3 --bind unix:/root/ayzguci/myapp/myapp.sock myapp.wsgi:application
1814 ? S 0:00 /root/ayzguci/myenv/bin/python3 /root/ayzguci/myenv/bin/gunicorn --access-logfile - --timeout 1000 --workers 3 --bind unix:/root/ayzguci/myapp/myapp.sock myapp.wsgi:application
1900 pts/0 S 0:00 grep --color=auto gunicorn
netstat -an|grep 8000 output:
root@localhost:~# sudo apt install net-tools
Reading package lists... Done
Building dependency tree
Reading state information... Done
net-tools is already the newest version (1.60 git20161116.90da8a0-1ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 72 not upgraded.
root@localhost:~# netstat -an|grep 8000
root@localhost:~#
CodePudding user response:
I don't understand what php-fpm
has to do with that ?