# nginx.conf file for chandler
#
# this is a example configuration file. adapt the config
# values to your own needs.
#
# the use of tls (e.g., let's encrypt) is recommended.
#
# to install, rename the file name, put it in
# /etc/nginx/sites-available and make a symlink to
# /etc/nginx/sites-enabled

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name domain.tld;

    root /opt/chandler/public;

    client_max_body_size 100m;

    index index.php;

    ssl_certificate /path/to/fullchain.pem;
    ssl_certificate_key /path/to/privkey.pem;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }

    # DO NOT DELETE "(?!well-known).*" if you want to use let's encrypt.
    location ~ /\.(?!well-known).* {
        deny all;
        access_log off;
        log_not_found off;
    }

    location ~ \index.php$ {
        # include fastcgi.conf;
        include fastcgi_params;
        # choose one of the above depending on your distribution.

        fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
        # when using a TCP socket, use the following:
        # fastcgi_pass 127.0.0.1:9000;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

server {
    listen 80;
    listen [::]:80;
    server_name domain.tld;
    return 301 https://$server_name$request_uri;
}
