• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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