i would change my nginx config so i could make non-SSL requests over certain URIs. Per example, when i request normal http to [host][certain-uri], avoid redirecting to https.
My current nginx.conf:
worker_processes 1;
user nobody nogroup;
pid /tmp/nginx.pid;
error_log /tmp/nginx.error.log;
events {
worker_connections 1024;
accept_mutex off;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /tmp/nginx.access.log combined;
sendfile on;
upstream app_server {
server unix:/tmp/gunicorn.sock fail_timeout=0;
# For a TCP configuration:
# server 192.168.0.7:8000 fail_timeout=0;
}
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
client_max_body_size 4G;
server_name _;
ssl_certificate /home/ubuntu/ssl_certificate/mnopi-cert.pem;
ssl_certificate_key /home/ubuntu/ssl_certificate/mnopi-key.pem;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
keepalive_timeout 5;
# path for static files
root /home/ubuntu/mnopi/mnopi/static/;
location /server-status
{
stub_status on;
access_log off;
allow all;
#deny all;
}
location /static {
alias /home/ubuntu/mnopi/mnopi/static;
}
location / {
# checks for static file, if not found proxy to app
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_pass http://localhost:8080;
}
location = /favicon.ico {
root /home/ubuntu/mnopi/;
}
location = /ping.gif {
root /home/ubuntu/mnopi/;
}
# error_page 500 502 503 504 /500.html;
# location = /500.html {
# root /path/to/app/current/public;
# }
}
}
Thanks in advance.
My current nginx.conf:
worker_processes 1;
user nobody nogroup;
pid /tmp/nginx.pid;
error_log /tmp/nginx.error.log;
events {
worker_connections 1024;
accept_mutex off;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /tmp/nginx.access.log combined;
sendfile on;
upstream app_server {
server unix:/tmp/gunicorn.sock fail_timeout=0;
# For a TCP configuration:
# server 192.168.0.7:8000 fail_timeout=0;
}
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
client_max_body_size 4G;
server_name _;
ssl_certificate /home/ubuntu/ssl_certificate/mnopi-cert.pem;
ssl_certificate_key /home/ubuntu/ssl_certificate/mnopi-key.pem;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
keepalive_timeout 5;
# path for static files
root /home/ubuntu/mnopi/mnopi/static/;
location /server-status
{
stub_status on;
access_log off;
allow all;
#deny all;
}
location /static {
alias /home/ubuntu/mnopi/mnopi/static;
}
location / {
# checks for static file, if not found proxy to app
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_pass http://localhost:8080;
}
location = /favicon.ico {
root /home/ubuntu/mnopi/;
}
location = /ping.gif {
root /home/ubuntu/mnopi/;
}
# error_page 500 502 503 504 /500.html;
# location = /500.html {
# root /path/to/app/current/public;
# }
}
}
Thanks in advance.