Skip to content

Instantly share code, notes, and snippets.

@Robinzon100
Last active August 30, 2022 09:41
Show Gist options
  • Save Robinzon100/8df831a781f53f9c6f17b79362fcb84b to your computer and use it in GitHub Desktop.
Save Robinzon100/8df831a781f53f9c6f17b79362fcb84b to your computer and use it in GitHub Desktop.
nginx defaults
server {
server_name excelreality.com www.excelreality.com;
location / {
add_header 'Access-Control-Allow-Origin' 'https://excelreality.com';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /api/{
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_pass http://localhost:5000;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/excelreality.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/excelreality.com/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 = www.excelreality.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = excelreality.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name excelreality.com www.excelreality.com;
listen 80;
return 404; # managed by Certbot
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment