Created
October 29, 2024 23:33
-
-
Save vishaldpatel/d9fb76bf2d027e6d2cd0e2a0886ac29d to your computer and use it in GitHub Desktop.
Nginx config for our project that will live in sites-available
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 443 ssl; | |
| server_name project_domain.tld www.project_domain.tld; | |
| root /home/project_owner/my_awesome_project/priv/static; | |
| ssl_certificate /etc/letsencrypt/live/project_domain_tld/cert.pem; | |
| ssl_certificate_key /etc/letsencrypt/live/project_domain_tld/privkey.pem; | |
| access_log /var/log/nginx/foo.access.log main; | |
| error_log /var/log/nginx/foo.error.log; | |
| location / { | |
| index index.html; | |
| try_files $uri @app; | |
| # expires max; | |
| # access_log off; | |
| } | |
| location @app { | |
| proxy_set_header Host $host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_set_header Refrerer $http_referer; | |
| proxy_set_header User-Agent $http_user_agent; | |
| # This is the address and port of our project. | |
| proxy_pass http://127.0.0.1:4007; | |
| } | |
| } | |
| server { | |
| listen 80 default_server; | |
| server_name _; | |
| return 301 https://$host$request_uri; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment