Skip to content

Instantly share code, notes, and snippets.

@gys-dev
Created February 22, 2022 03:15
Show Gist options
  • Save gys-dev/861e9c34c7836dd13eac55d61ffca986 to your computer and use it in GitHub Desktop.
Save gys-dev/861e9c34c7836dd13eac55d61ffca986 to your computer and use it in GitHub Desktop.
Sample Nignx Config
server {
server_name quizzes.vfftech.com vumax.me;
access_log /var/log/nginx/app.log;
error_log /var/log/nginx/app.error.log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://localhost:3000;
proxy_redirect http://localhost/ http://localhost:3000/;
}
location ^~ /api {
proxy_pass http://localhost:3600/api;
}
location ^~ /uploads {
proxy_pass http://localhost:3600/uploads/;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/quizzes.vfftech.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/quizzes.vfftech.com/privkey.pem; # managed by Certbot
# ssl_certificate /etc/letsencrypt/live/vumax.me/fullchain.pem; # managed by Certbot
# ssl_certificate_key /etc/letsencrypt/live/vumax.me/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = quizzes.vfftech.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name quizzes.vfftech.com;
return 404; # managed by Certbot
}
server {
if ($host = vumax.me) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name vumax.me
return 404; # managed by Certbot
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment