0

So I have a Craft CMS multi-site setup on a Forge-managed VPS... (and oh boy I wish there was more documentation on setting this up, huge thanks to Philip for helping me get to this point)

The location ~* (.+)\.(?:\d+)\.(js|css|png|jpg|jpeg|gif|webp)$ { try_files $uri $1.$2; } line (scroll down to "USUAL FORGE STUFF" in the config file below) allows the likes of style.min.3.css to resolve as style.min.css.

The rewrite works fine for maindomain.com, but how do I enable it for the recently-added secondarydomain.com?

(I can't figure out how to make it play nicely with the 301 redirect - it's clearly bypassing the try_files directive at present.)

Thanks!

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/www.maindomain.com/before/*;

server {
   listen 80;
    listen [::]:80;

    server_name secondarydomain.com;
    return 301 https://www.secondarydomain.com$request_uri;
}

server {
    listen 80;
    listen [::]:80;

    server_name www.secondarydomain.com;
    return 301 https://www.secondarydomain.com$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    ssl_certificate /etc/nginx/ssl/www.maindomain.com/123456/server.crt;
    ssl_certificate_key /etc/nginx/ssl/www.maindomain.com/123456/server.key;

    ssl_protocols TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/nginx/dhparams.pem;

    server_name secondarydomain.com;
    return 301 https://www.secondarydomain.com$request_uri;

}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name www.maindomain.com www.secondarydomain.com;
    root /home/forge/www.maindomain.com/web;

    # .... USUAL FORGE STUFF....

    # Cache busting via nystudio107 - how do I make this work for secondarydomain.com ?
    location ~* (.+)\.(?:\d+)\.(js|css|png|jpg|jpeg|gif|webp)$ {
        try_files $uri $1.$2;
    }

}

# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/www.maindomain.com/after/*;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.