Last active
May 16, 2019 06:56
-
-
Save mskian/6920a79f76a38ea6602123a40b00ba65 to your computer and use it in GitHub Desktop.
Nginx Configuration for Fathom Website Analytics π
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 80; | |
listen [::]:80; | |
listen 443 ssl http2; | |
listen [::]:443 ssl http2; | |
server_name stats.example.com; | |
root /var/www/stats; | |
# Redirect HTTP to HTTPS - Remove this if you are Not Configuring SSL for your Site | |
if ($scheme = http) { | |
return 301 https://$server_name$request_uri; | |
} | |
# For SSL Verification if you install SSL Via acme.sh client keep this otherwise remove this block | |
location '/.well-known/acme-challenge' { | |
default_type "text/plain"; | |
root /var/www/stats; | |
allow all; | |
} | |
location / { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host $http_host; | |
proxy_pass http://127.0.0.1:9000; | |
proxy_redirect off; | |
} | |
client_max_body_size 70m; | |
ssl_certificate /etc/letsencrypt/stats.example.com/fullchain.cer; | |
ssl_certificate_key /etc/letsencrypt/stats.example.com/stats.example.com.key; | |
add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment