Last active
October 1, 2018 21:38
-
-
Save jsanta/d23f373a8aebbeadf8f881976cc5f294 to your computer and use it in GitHub Desktop.
some_available_site configuration file for nginx, result of some research and certbot generated configuration
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 { | |
| root /opt/www; | |
| # Add index.php to the list if you are using PHP | |
| index index.html index.htm index.nginx-debian.html; | |
| server_name your_server www.your_server; | |
| location / { | |
| # First attempt to serve request as file, then | |
| # as directory, then fall back to displaying a 404. | |
| try_files $uri $uri/ =404; | |
| } | |
| location /some_app { | |
| alias /opt/some_app/www; | |
| try_files $uri$args $uri$args/ /some_app/index.html; | |
| } | |
| listen [::]:443; # not managed by Certbot | |
| ssl on; # not managed by Certbot | |
| listen 443 ssl; # managed by Certbot | |
| ssl_certificate /etc/letsencrypt/live/your_server/fullchain.pem; # managed by Certbot | |
| ssl_certificate_key /etc/letsencrypt/live/your_server/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.your_server) { | |
| return 301 https://$host$request_uri; | |
| } # managed by Certbot | |
| if ($host = api.your_server) { | |
| return 301 https://$host$request_uri; | |
| } # managed by Certbot | |
| if ($host = your_server) { | |
| return 301 https://$host$request_uri; | |
| } # managed by Certbot | |
| listen 80 default_server; | |
| listen [::]:80 default_server; | |
| server_name your_server www.your_server api.your_server; | |
| return 404; # managed by Certbot | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Configuration included in article posted at https://medium.com/@JSantaCL/nginx-nodejs-and-spas-cc50c376b131