
server {
    listen       80;
    server_name   www.DOMAINname;
    return       301 http://DOMAINname$request_uri;
}

server {
    listen 80;
    listen [::]:80;
    
    index index.php index.html index.htm index.nginx-debian.html;
    server_name DOMAINname;
    gzip on;
    gzip_proxied any;
    gzip_types text/plain text/css text/xml text/javascript application/javascript application/x-javascript image/svg image/svg+xml application/xml image/x-icon;
    gzip_comp_level 2;
    gzip_disable "msie6";
    gzip_buffers 16 8k;
    
    location ~* (.*) {
            root /var/www/DOMAINname/html/public;
            try_files $1 @app_index;
    }

    location @app_index {
            root /var/www/DOMAINname/html/public;
            fastcgi_pass unix:/run/php/phpPHPver-fpm.sock;
            fastcgi_index  index.php;
            include        fastcgi_params;
            fastcgi_param  SCRIPT_FILENAME $document_root/index.php;
            fastcgi_param  SCRIPT_NAME /index.php;
    }

    location ~ /\.ht {
        deny all;
    }


    #Cache everything by default
    set $no_cache 0;

    #Don't cache POST requests
    if ($request_method = POST) {
        set $no_cache 1;
    }

    #Don't cache if the URL contains a query string
    if ($query_string != "") {
        set $no_cache 1;
    }

    #Don't cache the following URLs
    if ($request_uri ~* "/(administrator/|login.php)") {
        set $no_cache 1;
    }

    #Don't cache if there is a cookie called PHPSESSID
    if ($http_cookie = "PHPSESSID") {
        set $no_cache 1;
    }
}