Created
June 13, 2025 19:41
-
-
Save Pinjontall94/cb41c50365860dc2b92b946cef9605c4 to your computer and use it in GitHub Desktop.
Nginx boilerplate
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
| # nginx automatically determines # of processes | |
| worker_processes auto; | |
| # each worker can handle this many active connections | |
| events { | |
| worker_connections 1024; | |
| } | |
| # handle http requests | |
| http { | |
| # handle .html as web pages, .jpg as images, etc. | |
| include mime.types; | |
| # download if not otherwise recognized as a known mime type | |
| default_type application/octet-stream; | |
| # enable sendfile syscall, for more efficient file serving | |
| sendfile on; | |
| # default timeout 65 seconds | |
| keepalive_timeout 65; | |
| server { | |
| listen 443 ssl; | |
| ssl_certificate /etc/nginx/ssl/mydomainname.com.crt; | |
| ssl_certificate_key /etc/nginx/ssl/mydomainname.com.key; | |
| root /var/www/html; | |
| index index.html index.htm; | |
| # specify name this server block will respond to | |
| server_name mydomainname.com; | |
| location / { | |
| try_files $uri $uri/ =404; | |
| } | |
| } | |
| server { | |
| listen 80; | |
| server_name mydomainname.com | |
| # redirect all http reqs to https | |
| return 301 https://$host$request_uri; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment