back to posts

My NGINX server setup for Lychee (photos hosting)


Note: the setting for large file upload.

server {

        root /var/www/Lychee;
        index  index.php index.html index.htm;

        charset utf-8;
        gzip on;
        gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;

        location / {
                  try_files $uri $uri/ /index.php?$query_string;

        location ~ \.php$ {
                  client_max_body_size 10M;
                  include fastcgi.conf;
                  include fastcgi_params;
                  fastcgi_split_path_info ^(.+\.php)(/.+)$;
                  fastcgi_index index.php;
                  fastcgi_pass unix:/run/php/php7.2-fpm.sock;

        location ~ /\.ht {
                  deny all;

If you found it useful, please consider signing up to my newsletter. Every week, I share my thoughts on cool stuff I found around the internet. No spam, ever. Unsubscribe any time.