Link Search Menu Expand Document

Default server block configuration

server {
        listen 80;
        listen [::]:80;
        server_name _;
        root /usr/share/nginx/html/; 
        # change to /var/www/html
        index index.php index.html index.htm index.nginx-debian.html;

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

        location ~ \.php$ {
            fastcgi_pass unix:/run/php/php7.4-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
            include snippets/fastcgi-php.conf;
        }

        location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
            access_log        off;
            log_not_found     off;
            expires           360d;
        }

        # disable access to hidden files
        location ~ /\.ht {
            access_log off;
            log_not_found off;
            deny all;
        }
}