albertyw/reaction-pics

View on GitHub
config/nginx/app

Summary

Maintainability
Test Coverage
# vi: ft=nginx

### Redirects ###

# Change IP address to domain name
server {
    listen          80;
    server_name     reaction.pics www.reaction.pics;
    return          301 https://www.reaction.pics$request_uri;
}

# Change naked domain to www
server {
    listen          443 ssl;
    http2           on;
    server_name     reaction.pics;

    include snippets/ssl.conf;
    resolver 1.1.1.1 1.0.0.1 [2606:4700:4700::1111] [2606:4700:4700::1001];

    rewrite         ^ https://www.reaction.pics$request_uri;
}


### Servers ###

server {
    listen          443 ssl;
    http2           on;
    server_name     www.reaction.pics;
    access_log      /var/log/nginx/reaction-pics/access.log;
    error_log       /var/log/nginx/reaction-pics/error.log;

    include snippets/ssl.conf;
    include snippets/gzip.conf;
    resolver 1.1.1.1 1.0.0.1 [2606:4700:4700::1111] [2606:4700:4700::1001];

    location / {
        include          snippets/headers.conf;
        proxy_pass       http://127.0.0.1:5003;
        proxy_buffering  off;
        add_header       'Cache-Control' 'no-store, no-cache';
        expires          7d;
    }

    location /static {
        include          snippets/headers.conf;
        proxy_pass       http://127.0.0.1:5003;
        proxy_buffering  off;
        add_header       'Cache-Control' "public";
        expires          7d;
    }
}