Initial commit
This commit is contained in:
110
nginx-config.txt
Normal file
110
nginx-config.txt
Normal file
@@ -0,0 +1,110 @@
|
||||
root@ip-172-31-3-64:/etc/nginx/sites-available# pwd
|
||||
/etc/nginx/sites-available
|
||||
root@ip-172-31-3-64:/etc/nginx/sites-available# cat sjdev.co
|
||||
# NGINX Configuration for sjdev.co
|
||||
# HTTP only - SSL will be added once certbot is resolved
|
||||
|
||||
server {
|
||||
server_name sjdev.co www.sjdev.co;
|
||||
|
||||
# Allow Let's Encrypt verification
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
# Root directory for demo apps
|
||||
set $apps_root /var/www/sjdev-demo-apps;
|
||||
|
||||
# ============================================
|
||||
# DEMO APPS - Static React Builds
|
||||
# ============================================
|
||||
|
||||
location /demos/salesflow {
|
||||
alias /var/salesflow/build/;
|
||||
try_files $uri $uri/ /demos/salesflow/index.html;
|
||||
}
|
||||
|
||||
location /demos/bookbrowser {
|
||||
alias /var/reactnd-project-bookbrowser/build/;
|
||||
try_files $uri $uri/ /demos/bookbrowser/index.html;
|
||||
}
|
||||
|
||||
location /demos/budgetize {
|
||||
alias /var/www/sjdev-demo-apps/budgetize;
|
||||
try_files $uri $uri/ /demos/budgetize/index.html;
|
||||
}
|
||||
|
||||
# ============================================
|
||||
# BACKEND API PROXY
|
||||
# ============================================
|
||||
|
||||
location /v1/ {
|
||||
proxy_pass http://localhost:3001;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
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_cache_bypass $http_upgrade;
|
||||
proxy_read_timeout 300;
|
||||
proxy_connect_timeout 300;
|
||||
}
|
||||
|
||||
# ============================================
|
||||
# NEXT.JS APPLICATION
|
||||
# ============================================
|
||||
|
||||
location /_next/static {
|
||||
proxy_pass http://localhost:3000;
|
||||
proxy_cache_valid 200 60m;
|
||||
add_header Cache-Control "public, max-age=3600, immutable";
|
||||
}
|
||||
|
||||
location / {
|
||||
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_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_cache_bypass $http_upgrade;
|
||||
proxy_read_timeout 300;
|
||||
proxy_connect_timeout 300;
|
||||
}
|
||||
|
||||
listen [::]:443 ssl ipv6only=on; # managed by Certbot
|
||||
listen 443 ssl; # managed by Certbot
|
||||
ssl_certificate /etc/letsencrypt/live/sjdev.co/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/sjdev.co/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.sjdev.co) {
|
||||
return 301 https://$host$request_uri;
|
||||
} # managed by Certbot
|
||||
|
||||
|
||||
if ($host = sjdev.co) {
|
||||
return 301 https://$host$request_uri;
|
||||
} # managed by Certbot
|
||||
|
||||
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name sjdev.co www.sjdev.co;
|
||||
return 404; # managed by Certbot
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user