Last active
January 28, 2023 15:00
-
-
Save ahmed-abdelazim/b3536c1780afc4215ef57633bbe77a88 to your computer and use it in GitHub Desktop.
This file contains 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 { | |
server_name test24.company.io; | |
index index.html; | |
root /home/ubuntu/project-source/company/entry; | |
location / { | |
root /home/ubuntu/project-source/company/entry; | |
} | |
listen 443 ssl; # managed by Certbot | |
ssl_certificate /etc/letsencrypt/live/test24.company.io/fullchain.pem; # managed by Certbot | |
ssl_certificate_key /etc/letsencrypt/live/test24.company.io/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 { | |
server_name sub1.test24.company.io; | |
location / { | |
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_cache_bypass $http_upgrade; | |
} | |
listen 443 ssl; # managed by Certbot | |
ssl_certificate /etc/letsencrypt/live/test24.company.io/fullchain.pem; # managed by Certbot | |
ssl_certificate_key /etc/letsencrypt/live/test24.company.io/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 { | |
server_name sub2.test24.company.io; | |
location / { | |
proxy_pass http://localhost:3002; | |
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; | |
} | |
listen 443 ssl; # managed by Certbot | |
ssl_certificate /etc/letsencrypt/live/test24.company.io/fullchain.pem; # managed by Certbot | |
ssl_certificate_key /etc/letsencrypt/live/test24.company.io/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 | |
} | |
## HTTPS REDIRECTS ## | |
server { | |
if ($host = test24.company.io) { | |
return 301 https://$host$request_uri; | |
} # managed by Certbot | |
listen 80; | |
server_name test24.company.io; | |
return 404; # managed by Certbot | |
} | |
server { | |
if ($host = sub1.test24.company.io) { | |
return 301 https://$host$request_uri; | |
} # managed by Certbot | |
listen 80; | |
server_name sub1.test24.company.io; | |
return 404; # managed by Certbot | |
} | |
server { | |
if ($host = sub2.test24.company.io) { | |
return 301 https://$host$request_uri; | |
} # managed by Certbot | |
listen 80; | |
server_name sub2.test24.company.io; | |
return 404; # managed by Certbot | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment