• The APS Catalog has been deprecated and removed from all Plesk Obsidian versions.
    Applications already installed from the APS Catalog will continue working. However, Plesk will no longer provide support for APS applications.
  • Please be aware: with the Plesk Obsidian 18.0.78 release, the support for the ngx_pagespeed.so module will be deprecated and removed from the sw-nginx package.

Question How to change NGINX configuration for one domain

JordyB

New Pleskian
Hi there,

I have migrated a website to my VPS (CentOS Linux 7.6.1810 (Core)‬, Plesk Onyx 17.8.11). The website that I have migrated is based on Silverstripe CMS. This website is running on a NGINX webserver. For a correct operation this configuration is needed:

Code:
server {
    listen 80;
    root /path/to/ss/folder;

    server_name site.com www.site.com;

    location / {
        try_files $uri /framework/main.php?url=$uri&$query_string;
    }

    error_page 404 /assets/error-404.html;
    error_page 500 /assets/error-500.html;

    location ^~ /assets/ {
        sendfile on;
        try_files $uri =404;
    }

    location ~ /framework/.*(main|rpc|tiny_mce_gzip)\.php$ {
        fastcgi_keep_conn on;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location ~ /(mysite|framework|cms)/.*\.(php|php3|php4|php5|phtml|inc)$ {
        deny all;
    }

    location ~ /\.. {
        deny all;
    }

    location ~ \.ss$ {
        satisfy any;
        allow 127.0.0.1;
        deny all;
    }

    location ~ web\.config$ {
        deny all;
    }

    location ~ \.ya?ml$ {
        deny all;
    }

    location ^~ /vendor/ {
        deny all;
    }

    location ~* /silverstripe-cache/ {
        deny all;
    }

    location ~* composer\.(json|lock)$ {
        deny all;
    }

    location ~* /(cms|framework)/silverstripe_version$ {
        deny all;
    }

    location ~ \.php$ {
                fastcgi_keep_conn on;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include        fastcgi_params;
    }
}

I know that you can add these lines of code in the additional configuration for Apache / NGINX. But it seems that this part of the code is not possible to add:

Code:
server {
    listen 80;
    root /path/to/ss/folder;

    server_name site.com www.site.com;

    location / {
        try_files $uri /framework/main.php?url=$uri&$query_string;
    }

Is there any way to add these lines within Plesk? Or do I have to use SSH and if so, how can I achieve this configuration?

Many thanks!

Jordy
 
Back
Top