Nginx questions - Edit default files and HTTP2

Yes I would; nginx.conf, nginx.forcessl.conf and nginx.conf_redirect

nginx.conf:

#=========================================================================#
# Default Web Domain Template                                             #
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS   #
# https://hestiacp.com/docs/server-administration/web-templates.html      #
#=========================================================================#

server {
    listen      10.0.0.177:80;
    server_name cooldomain.com www.cooldomain.com;
    root        /home/cooldomain.com/web/cooldomain.com/public_html;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/cooldomain.com.log combined;
    access_log  /var/log/nginx/domains/cooldomain.com.bytes bytes;
    error_log   /var/log/nginx/domains/cooldomain.com.error.log error;

    include /home/cooldomain.com/conf/web/cooldomain.com/nginx.forcessl.conf*;

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        try_files $uri $uri/ /index.php?$args;
        log_not_found off;
        access_log off;
    }

    location ~ /\.(?!well-known\/) {
        deny all;
        return 404;
    }

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

        location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
            expires 30d;
            fastcgi_hide_header "Set-Cookie";
        }

        location ~* /(?:uploads|files)/.*.php$ {
            deny all;
            return 404;
        }

        location ~ [^/]\.php(/|$) {
            try_files $uri =404;

            include /etc/nginx/fastcgi_params;

            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

            fastcgi_pass unix:/run/php/php8.2-fpm-cooldomain.com.sock;

            include /home/cooldomain.com/conf/web/cooldomain.com/nginx.fastcgi_cache.conf*;

            if ($request_uri ~* "/wp-admin/|/wp-json/|wp-.*.php|xmlrpc.php|index.php|/store.*|/cart.*|/my-account.*|/checkout.*") {
                set $no_cache 1;
            }

            if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|woocommerce_items_in_cart|woocommerce_cart_hash|PHPSESSID") {
                set $no_cache 1;
            }
        }
    }

    location /error/ {
        alias /home/cooldomain.com/web/cooldomain.com/document_errors/;
    }

    location /vstats/ {
        alias   /home/cooldomain.com/web/cooldomain.com/stats/;
        include /home/cooldomain.com/web/cooldomain.com/stats/auth.conf*;
    }

    include /etc/nginx/conf.d/phpmyadmin.inc*;
    include /etc/nginx/conf.d/phppgadmin.inc*;
    include /home/cooldomain.com/conf/web/cooldomain.com/nginx.conf_*;
}

nginx.forcessl.conf:

return 301 https://$host$request_uri;

nginx.conf_redirect:

if ($host != "www.cooldomain.com") {
   return 301 $scheme://www.cooldomain.com $request_uri;
}

All looks good, could you please show how are you testing it?

When surfing the sites via http:// on a browser you are prompt to download the page, if you test it via curl you get:

curl: (1) Received HTTP/0.9 when not allowed

Too late here, I’ll take a look in the morning.

Could you confirm whether your actual domain is hp.loxxxxxxxxxxxxxgn.com?

I’ll send you via DM a different domain that you can test

1 Like

Just for the records.

The problem was that @Ade removed http2 from listen heretheip:80 http2; directive in the template but didn’t rebuild the domain to apply the changes.

1 Like