writefreely/templates/nginx.conf.j2
changeset 119 a96a5eb96e32
equal deleted inserted replaced
118:56bffa9ef826 119:a96a5eb96e32
       
     1 server {
       
     2     listen 80;
       
     3     server_name {{nginx_server_name}};
       
     4     return 301 https://$host$request_uri;
       
     5 }
       
     6 
       
     7 server {
       
     8     listen 443 ssl http2;
       
     9     server_name {{nginx_server_name}};
       
    10 
       
    11     ssl_certificate {{nginx_ssl_cert}};
       
    12     ssl_certificate_key {{nginx_ssl_privkey}};
       
    13     ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1;
       
    14 
       
    15     gzip on;
       
    16     gzip_types
       
    17       application/javascript
       
    18       application/x-javascript
       
    19       application/json
       
    20       application/rss+xml
       
    21       application/xml
       
    22       image/svg+xml
       
    23       image/x-icon
       
    24       application/vnd.ms-fontobject
       
    25       application/font-sfnt
       
    26       text/css
       
    27       text/plain;
       
    28     gzip_min_length 256;
       
    29     gzip_comp_level 5;
       
    30     gzip_http_version 1.1;
       
    31     gzip_vary on;
       
    32 
       
    33     location ~ ^/.well-known/(webfinger|nodeinfo|host-meta) {
       
    34         proxy_set_header Host $host;
       
    35         proxy_set_header X-Real-IP $remote_addr;
       
    36         proxy_set_header X-Forwarded-For $remote_addr;
       
    37         proxy_pass http://127.0.0.1:{{nginx_proxy_port}};
       
    38         proxy_redirect off;
       
    39     }
       
    40 
       
    41     location ~ ^/(css|img|js|fonts)/ {
       
    42         root {{nginx_static_content}};
       
    43         # Optionally cache these files in the browser:
       
    44         # expires 12M;
       
    45     }
       
    46 
       
    47     location / {
       
    48         proxy_set_header Host $host;
       
    49         proxy_set_header X-Real-IP $remote_addr;
       
    50         proxy_set_header X-Forwarded-For $remote_addr;
       
    51         proxy_pass http://127.0.0.1:{{nginx_proxy_port}};
       
    52         proxy_redirect off;
       
    53     }
       
    54 }