Created
April 26, 2017 13:21
-
-
Save adamcooke/30c48ea101f040d07a83bfd066a1e427 to your computer and use it in GitHub Desktop.
Example nginx configuration for Postal
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 { | |
listen [::]:80; | |
listen 0.0.0.0:80; | |
server_name postal.yourdomain.com; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen [::]:443 ssl; | |
listen 0.0.0.0:443 ssl; | |
root /opt/postal/app/public; | |
server_name postal.yourdomain.com; | |
ssl_certificate ssl/postal.crt; | |
ssl_certificate_key ssl/postal.key; | |
# Generate using: openssl dhparam 4096 -out /etc/ssl/dhparam.pem | |
ssl_dhparam /etc/ssl/dhparam.pem; | |
ssl_protocols TLSv1.2 TLSv1.1 TLSv1; | |
ssl_prefer_server_ciphers on; | |
ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA512:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:ECDH+AESGCM:ECDH+AES256:DH+AESGCM:DH+AES256:RSA+AESGCM:!aNULL:!eNULL:!LOW:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS; | |
location / { | |
client_max_body_size 50M; | |
try_files $uri $uri/index.html $uri.html @puma; | |
} | |
location /assets { | |
add_header Cache-Control max-age=3600; | |
} | |
location @puma { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto https; | |
proxy_pass http://127.0.0.1:5000; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment