Skip to content

Instantly share code, notes, and snippets.

@TheManFromEarth1
Created February 5, 2021 00:21
Show Gist options
  • Save TheManFromEarth1/a6106c53f1e05480ad0b106c8560fbc6 to your computer and use it in GitHub Desktop.
Save TheManFromEarth1/a6106c53f1e05480ad0b106c8560fbc6 to your computer and use it in GitHub Desktop.
server {
# listen HTTP
listen 80;
server_name api.domain.com;
# Redirect HTTPS
return 301 https://$host$request_uri;
}
server {
# Listen HTTP
listen 443;
server_name api.domain.com;
# SSL Config
ssl on;
ssl_certificate /etc/nginx/ssl/api.domain.com.crt;
ssl_certificate_key /etc/nginx/ssl/api.domain.com.key;
# Proxy Config
location / {
proxy_pass http://strapi;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $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_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass_request_headers on;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment