Last active
April 15, 2023 12:03
-
-
Save shellking4/cdd3bed80ed22d9f243780b7c07fca21 to your computer and use it in GitHub Desktop.
nginx config 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
#SSL certificates issuing | |
sudo openssl req -x509 -sha256 -nodes -newkey rsa:2048 -days 36500 -keyout /etc/ssl/main.key -out /etc/ssl/main.crt | |
# Nginx Conf | |
upstream backend { | |
server 127.0.0.1:3000; | |
keepalive 64; | |
} | |
server { | |
listen 80; | |
server_name www.aparsys.api aparsys.api; | |
return 301 https://aparsys.api$request_uri; | |
} | |
server { | |
listen 443 ssl; | |
server_name www.aparsys.api aparsys.api; | |
ssl_certificate_key /etc/ssl/main.key; | |
ssl_certificate /etc/ssl/main.crt; | |
location / { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host $http_host; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
proxy_pass http://backend/; | |
proxy_redirect off; | |
proxy_read_timeout 240s; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment