I have this Nginx configuration file set up:
server {
listen 80;
server_name example.com www.example.com;
location /flasky {
include proxy_params;
proxy_pass http://unix:/tmp/flasky.sock;
}
}
I'm using Gunicorn to bind to the socket file while running my app. I changed the ownership of the /tmp directory to www-run:www-run but I'm still getting a permission denied error. What am I doing wrong?
Edit: Here is my Nginx.conf file. It is the default that comes loaded with Nginx when installed:
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;
# server_name_in_redirect off;
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_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/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
Here is the virtual host file I'm trying to use:
server {
listen 80;
server_name mywebsite.com www.mywebsite.com;
location /flasky {
include proxy_params;
proxy_pass http://127.0.0.1:8090;
}
}
And finally, the Gunicorn command I am running is:
gunicorn -b 0.0.0.0:8090 -w 2 wsgi:applicaiton
Related
I'm working through https://serversforhackers.com/video/letsencrypt-for-free-easy-ssl-certificates and https://certbot.eff.org/docs/intro.html , trying to add an ssl certificate to my site. I tried:
root#server:/opt/certbot# ./certbot-auto certonly --webroot -w /var/www/html --agree-tos --email me#yahoo.com -d mysite.com -d www.mysite.com --non-interactive
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for example.com
http-01 challenge for www.example.com
Using the webroot path /var/www/html for all unmatched domains.
...
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: example.com
Type: unauthorized
Detail: Invalid response from
example.com.well-known/acme-challenge/gygb7wEj3o-_5MIoUgraBRddmqrtZdfIM-UWMySoNl8:
Domain: www.example.com
Type: unauthorized
Detail: Invalid response from
www.example.com.well-known/acme-challenge/z8oZ1FAiHBJNwWvLTI-g9hMZ5zoLdJSZBgaQ9CSTJU0:
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A record(s) for that domain
contain(s) the right IP address.
root#server:/opt/certbot# cd .
I checked the domain name and A record and they seem to be OK. In my browser I opened the link and I see the screenshot, which makes sense since I'm running a django app.
How can I set things so that the certbot can access the webroot?
edit :
root#server:/etc/nginx# cat nginx.conf
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 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_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/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
/var/log/nginx/access.log shows:
66.133.109.36 - - [10/Feb/2017:13:16:40 -0500] "GET /.well-known/acme-challenge/-GMR_DzXR-oOTzl7LEesFiQI0H-2zCak2Bq3cDO7mTQ HTTP/1.1" 404 1080 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)"
66.133.109.36 - - [10/Feb/2017:13:16:40 -0500] "GET /.well-known/acme-challenge/4hTpEFaTJDTCiAS-Y9242MmNngEHM6e9cPr2WIdCL4Q HTTP/1.1" 404 1083 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)"
/var/log/nginx/error.log shows no errors.
Also I notice that there are no files in the .well known directory:
deploy#server:/var/www/html/.well-known$ ll
total 8
drwxrwxrwx 2 root root 4096 Feb 11 10:20 ./
drwxr-xr-x 3 root root 4096 Feb 10 09:29 ../
edit 2: In /etc/nginx/sites-available/mysite I've changed it to:
server {
listen 80;
server_name mysite.com www.mysite.com;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/deploy/mysite;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi/mysite.sock;
}
location ~ /.well-known {
allow all;
}
}
restarted nginx - same error
The following worked in the site's server block:
server {
listen 80;
server_name mysite.com www.mysite.com;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/deploy/mysite;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi/mysite.sock;
}
location ^~ /\.well-known {
allow all;
}
}
edit: here's another option that may work:
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /var/www/html;
I am learning nginx and configuring nginx.conf with gunicorn. I am running gunicorn on port 8000 and nginx listening on port 80. Sometimes it works fine, sometimes it gives an "Unable to connect" error.
Here is my 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 is my supervisor config file
[program:python-activate]
directory=<path of my 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 is my nginx python conf file
server {
# the port your site will be served on
listen 80;
# the domain name it will serve for
server_name <ipaddress>; # substitute by your FQDN and machine's IP address
charset utf-8;
#Max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
root /home/ashiyap/test/wp005_v02.00.00.d2_itr1/proj; # your Django project's media files
autoindex off;
}
location /static {
root /home/ashiyap/test/wp005_v02.00.00.d2_itr1/proj; # your Django project's static file
autoindex off;
}
# Finally, send all non-media requests to the 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;
}
}
I have a .py script that saves a base64 file to a png file
# SAVE BASE64 STRING TO PNG IMAGE
timestr = time.strftime("%Y%m%d%H%M%S")
filename = "/user_score/"+self.user.username+timestr+".png"
saved_file = MEDIA_ROOT+"/"+filename
fh = open(saved_file, "wb")
fh.write(imgbase64.decode('base64'))
fh.close()
This is being called through an AJAX function to an URL like this one
http://example-domain.com/score/save_image/?img=iVBORw0KGgoAAAANSUhEUgAAA4QAAAJYCAYAAAA6xSjbAAAgAElEQVR4Xu3b0ZYUN7KGUfz%2BD92z2mMYzDRUZkkKhfLf59ZFSrFDXHyLM399fHx8fPN%2FBAgQIECAAAECBAgQIBAn8JcgjNu5gQkQIECAAAECBAgQIPC3gCD0EAgQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAAECBAgIQm%2BAAAECBAgQIECAAAECoQKCMHTxxiZAgAABAgQIECBAgIAg9AYIECBAgAABAgQIECAQKiAIQxdvbAIECBAgQIAAAQIECAhCb4AAAQIECBAgQIAAAQKhAoIwdPHGJkCAAAECBAgQIECAgCD0BggQIECAAAECBAgQIBAqIAhDF29sAgQIECBAgAABAgQICEJvgAABAgQIECBAgAABAqECgjB08cYmQIAAAQIECBAgQICAIPQGCBAgQIAAAQIECBAgECogCEMXb2wCBAgQIECAAA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yXIUAAQIECBAgQIAAAQKVAoKwUttZBAgQIECAAAECBAgQaCQgCBstw1UIECBAgAABAgQIECBQKSAIK7WdRYAAAQIECBAgQIAAgUYCgrDRMlyFAAECBAgQIECAAAEClQKCsFLbWQQIECBAgAABAgQIEGgkIAgbLcNVCBAgQIAAAQIECBAgUCkgCCu1nUWAAAECBAgQIECAAIFGAoKw0TJchQABAgQIECBAgAABApUCgrBS21kECBAgQIAAAQIECBBoJCAIGy3DVQgQIECAAAECBAgQIFApIAgrtZ1FgAABAgQIECBAgACBRgKCsNEyXIUAAQIECBAgQIAAAQKVAoKwUttZBAgQIECAAAECBAgQaCQgCBstw1UIECBAgAABAgQIECBQKSAIK7WdRYAAAQIECBAgQIAAgUYCgrDRMlyFAAECBAgQIECAAAEClQKCsFLbWQQIECBAgAABAgQIEGgkIAgbLcNVCBAgQIAAAQIECBAgUCkgCCu1nUWAAAECBAgQIECAAIFGAoKw0TJchQABAgQIECBAgAABApUCgrBS21kECBAgQIAAAQIECBBoJCAIGy3DVQgQIECAAAECBAgQIFApIAgrtZ1FgAABAgQIECBAgACBRgKCsNEyXIUAAQIECBAgQIAAAQKVAoKwUttZBAgQIECAAAECBAgQaCQgCBstw1UIECBAgAABAgQIECBQKSAIK7WdRYAAAQIECBAgQIAAgUYCgrDRMlyFAAECBAgQIECAAAEClQKCsFLbWQQIECBAgAABAgQIEGgkIAgbLcNVCBAgQIAAAQIECBAgUCkgCCu1nUWAAAECBAgQIECAAIFGAoKw0TJchQABAgQIECBAgAABApUCgrBS21kECBAgQIAAAQIECBBoJCAIGy3DVQgQIECAAAECBAgQIFApIAgrtZ1FgAABAgQIECBAgACBRgKCsNEyXIUAAQIECBAgQIAAAQKVAoKwUttZBAgQIECAAAECBAgQaCQgCBstw1UIECBAgAABAgQIECBQKSAIK7WdRYAAAQIECBAgQIAAgUYCgrDRMlyFAAECBAgQIECAAAEClQKCsFLbWQQIECBAgAABAgQIEGgkIAgbLcNVCBAgQIAAAQIECBAgUCkgCCu1nUWAAAECBAgQIECAAIFGAoKw0TJchQABAgQIECBAgAABApUCgrBS21kECBAgQIAAAQIECBBoJCAIGy3DVQgQIECAAAECBAgQIFApIAgrtZ1FgAABAgQIECBAgACBRgKCsNEyXIUAAQIECBAgQIAAAQKVAoKwUttZBAgQIECAAAECBAgQaCQgCBstw1UIECBAgAABAgQIECBQKSAIK7WdRYAAAQIECBAgQIAAgUYCgrDRMlyFAAECBAgQIECAAAEClQKCsFLbWQQIECBAgAABAgQIEGgkIAgbLcNVCBAgQIAAAQIECBAgUCkgCCu1nUWAAAECBAgQIECAAIFGAoKw0TJchQABAgQIECBAgAABApUCgrBS21kECBAgQIAAAQIECBBoJCAIGy3DVQgQIECAAAECBAgQIFApIAgrtZ1FgAABAgQIECBAgACBRgKCsNEyXIUAAQIECBAgQIAAAQKVAoKwUttZBAgQIECAAAECBAgQaCQgCBstw1UIECBAgAABAgQIECBQKSAIK7WdRYAAAQIECBAgQIAAgUYCgrDRMlyFAAECBAgQIECAAAEClQKCsFLbWQQIECBAgAABAgQIEGgkIAgbLcNVCBAgQIAAAQIECBAgUCkgCCu1nUWAAAECBAgQIECAAIFGAoKw0TJchQABAgQIECBAgAABApUCgrBS21kECBAgQIAAAQIECBBoJCAIGy3DVQgQIECAAAECBAgQIFApIAgrtZ1FgAABAgQIECBAgACBRgKCsNEyXIUAAQIECBAgQIAAAQKVAoKwUttZBAgQIECAAAECBAgQaCQgCBstw1UIECBAgAABAgQIECBQKSAIK7WdRYAAAQIECBAgQIAAgUYCgrDRMlyFAAECBAgQIECAAAEClQKCsFLbWQQIECBAgAABAgQIEGgkIAgbLcNVCBAgQIAAAQIECBAgUCkgCCu1nUWAAAECBAgQIECAAIFGAoKw0TJchQABAgQIECBAgAABApUCgrBS21kECBAgQIAAAQIECBBoJCAIGy3DVQgQIECAAAECBAgQIFApIAgrtZ1FgAABAgQIECBAgACBRgKCsNEyXIUAAQIECBAgQIAAAQKVAoKwUttZBAgQIECAAAECBAgQaCQgCBstw1UIECBAgAABAgQIECBQKSAIK7WdRYAAAQIECBAgQIAAgUYCgrDRMlyFAAECBAgQIECAAAEClQKCsFLbWQQIECBAgAABAgQIEGgkIAgbLcNVCBAgQIAAAQIECBAgUCkgCCu1nUWAAAECBAgQIECAAIFGAoKw0TJchQABAgQIECBAgAABApUCgrBS21kECBAgQIAAAQIECBBoJCAIGy3DVQgQIECAAAECBAgQIFApIAgrtZ1FgAABAgQIECBAgACBRgKCsNEyXIUAAQIECBAgQIAAAQKVAoKwUttZBAgQIECAAAECBAgQaCQgCBstw1UIECBAgAABAgQIECBQKSAIK7WdRYAAAQIECBAgQIAAgUYCgrDRMlyFAAECBAgQIECAAAEClQKCsFLbWQQIECBAgAABAgQIEGgkIAgbLcNVCBAgQIAAAQIECBAgUCkgCCu1nUWAAAECBAgQIECAAIFGAoKw0TJchQABAgQIECBAgAABApUCgrBS21kECBAgQIAAAQIECBBoJCAIGy3DVQgQIECAAAECBAgQIFApIAgrtZ1FgAABAgQIECBAgACBRgKCsNEyXIUAAQIECBAgQIAAAQKVAoKwUttZBAgQIECAAAECBAgQaCQgCBstw1UIECBAgAABAgQIECBQKSAIK7WdRYAAAQIECBAgQIAAgUYCgrDRMlyFAAECBAgQIECAAAEClQKCsFLbWQQIECBAgAABAgQIEGgkIAgbLcNVCBAgQIAAAQIECBAgUCkgCCu1nUWAAAECBAgQIECAAIFGAoKw0TJchQABAgQIECBAgAABApUCgrBS21kECBAgQIAAAQIECBBoJCAIGy3DVQgQIECAAAECBAgQIFApIAgrtZ1FgAABAgQIECBAgACBRgKCsNEyXIUAAQIECBAgQIAAAQKVAoKwUttZBAgQIECAAAECBAgQaCQgCBstw1UIECBAgAABAgQIECBQKSAIK7WdRYAAAQIECBAgQIAAgUYCgrDRMlyFAAECBAgQIECAAAEClQKCsFLbWQQIECBAgAABAgQIEGgk8B%2B6jaetVJ6%2FbAAAAABJRU5ErkJggg%3D%3D
It is working fine when I run on django runserver, both on local and production environments.
However it gives me an 502 when running on production with NGINX.
So everything points out to NGINX.
This is the NGINX conf file, though I can't access the error logs (another programmer did the setup)
user www-data;
worker_processes 5;
pid /var/run/nginx.pid;
events {
worker_connections 6000;
multi_accept on;
use epoll;
}
http {
##
# Basic Settings
##
client_max_body_size 30M;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 300;
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;
##
# 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;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
#timeout
#proxy_read_timeout 1200;
uwsgi_read_timeout 1200;
client_body_timeout 120;
client_header_timeout 120;
send_timeout 100;
client_body_buffer_size 10K;
client_header_buffer_size 1k;
#client_max_body_size 8m;
large_client_header_buffers 4 32k;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
Any ideas appreciated.
This was solved by a comment by ohrstrom, who linked to this answer:
https://serverfault.com/questions/564464/nginx-request-line-too-large/564468#564468
These parameters:
client_header_buffer_size 1k;
large_client_header_buffers 4 32k;
Were blocking the call.
Aside from that it was a VERY bad idea on my side sending such a large amount of data in the url. I ended up using a POST with the base64 data on the body and that solved the problem.
As I said in the title, I restarted the nginx server for my site and then made a query to the db that I had done many times before. I can see that the db wasn't accidentally wiped, and I can see that the request payload is still correct. I didn't change any of the code relating to db access, so why is this happening?
here is the Nginx configuration file:
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;
##
# 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;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
The answer is not to restart Nginx.
What is the query? How is Nginx configured? How and why are you restarting it?
I am trying to follow this guide here to run flask app with ngnix. I followed everything but nginx still serves the default page and not from my app.
Attached are my conf files -
app.ini
[uwsgi]
module = wsgi
callable = app
master = true
processes = 3
socket = potter.sock
chmod-socket = 777
vacuum = true
die-on-term = true
Upstart script potter.conf
description "uWSGI server instance configured to serve potter"
start on runlevel [2345]
stop on runlevel [!2345]
setuid root
setgid root
env PATH=/root/jobs_env/bin
chdir /root/potter
exec uwsgi --ini app.ini
nginx.conf
user root;
worker_processes 4;
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;
##
# 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;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
potter in sites-enabled for nginx
server {
listen 80;
server_name 178.62.31.95;
location / {
include uwsgi_params;
uwsgi_pass unix:/root/potter/potter.sock;
}
}
EDIT -
I get the following error in nginx error logs -
2015/05/06 16:46:12 [error] 19614#0: *3 connect() to unix:/tmp/potter.sock failed (111: Connection refused) while connecting to upstream, client: 113.193.186.206, server: potter.hack, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:/tmp/potter.sock:", host: "178.62.31.95"
Give it a try with these changes:
app.ini
[uwsgi]
...
socket = 127.0.0.1:5678 # Use the inner port you want for this
...
in /etc/nginx/sites-enabled/potter add:
upstream uwsgi_myupsocket {
server 127.0.0.1:5678;
}
server {
[...]
location / {
include uwsgi_params;
uwsgi_pass uwsgi_myupsocket;
[...]
}
[...]
}
I hope this will help.
EDIT: You can try to execute manually the .ini file from shell:
root#yourmachine:~/potter# uwsgi app.ini
Output should give information about what's wrong with the configuration