Skip to content

Instantly share code, notes, and snippets.

@ericksuryadinata
Last active May 1, 2020 23:04
Show Gist options
  • Save ericksuryadinata/ef31e42dec4089726fb8bc241566554a to your computer and use it in GitHub Desktop.
Save ericksuryadinata/ef31e42dec4089726fb8bc241566554a to your computer and use it in GitHub Desktop.
Configuration Nginx Server
server{
server_name your-tld-server-name.com www.your-tld-server-name.com
# this configuration for serving python application
location / {
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_pass_header Authorization;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_pass http://127.0.0.1:44466;
proxy_read_timeout 3600;
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
}
# for serving node js application
location / {
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_pass_header Authorization;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_pass http://127.0.0.1:3333;
proxy_read_timeout 90;
}
# reserving php application with folder protected options
location /your-folder-name {
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_pass_header Authorization;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_pass http://127.0.0.1:14045;
proxy_read_timeout 3600;
}
# for https purpose
location ~ /.well-known{
allow all;
proxy_pass http://127.0.0.1:44466;
proxy_http_version 1.1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment