Created
March 20, 2020 14:27
-
-
Save derrickmehaffy/b20a2d281b3ff5a16ea45d924797f578 to your computer and use it in GitHub Desktop.
Strapi Nginx Sample Config for SSL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| # Listen HTTP | |
| listen 80; | |
| server_name api.example.com; | |
| # Redirect to HTTPS | |
| return 301 https://$host$request_uri; | |
| } | |
| server { | |
| # Listen HTTPS | |
| listen 443; | |
| server_name api.example.com; | |
| # SSL Config | |
| ssl_certificate /path/to/your/crt/file; | |
| ssl_certificate_key /path/to/your/key/file; | |
| # 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; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| upstream strapi { | |
| server 127.0.0.1:1337; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment