Skip to content

Instantly share code, notes, and snippets.

@Eyakub
Created June 8, 2020 22:21
Show Gist options
  • Save Eyakub/91dad53497010166aba0faef03f5c34b to your computer and use it in GitHub Desktop.
Save Eyakub/91dad53497010166aba0faef03f5c34b to your computer and use it in GitHub Desktop.
server
{
# Listen
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
# Directory & Server Naming
server_name exapmle.com www.exapmle.com;
http2_push_preload on;
# HTTP to HTTPS redirection
if ($scheme != "https")
{
return 301 https://$host$request_uri;
}
# SSL
ssl_certificate /etc/letsencrypt/live/exapmle.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/exapmle.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/exapmle.com/fullchain.pem;
# Disable Hidden FIle Access Except Lets Encrypt Verification
location ~ /\.well-known
{
allow all;
}
# Nginx Logging
access_log /var/log/nginx/exapmle.com-access.log;
error_log /var/log/nginx/exapmle.com-error.log warn;
# Max Upload Size
client_max_body_size 100M;
access_log off;
location /static/
{
root /var/www/django/;
}
#location / {
# proxy_pass http://127.0.0.1:8001;
# proxy_set_header X-Forwarded-Host $server_name;
# proxy_set_header X-Real-IP $remote_addr;
# add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
#}
location /
{
include proxy_params;
proxy_pass http://unix:/var/www/django/project.sock;
#proxy_set_header X-Forwarded-Host $server_name;
#proxy_set_header X-Real-IP $remote_addr;
#add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
}
# Robot Text Logging Off
location = /robots.txt
{
allow all;
log_not_found off;
access_log off;
}
# Fav ICON Disable
location = /favicon.ico
{
log_not_found off;
access_log off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment