• 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!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • 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 can I make my changes to Nginx site config Permanent per site?

ShockWave

New Pleskian
Server operating system version
Centos 7.9
Plesk version and microupdate number
18.0.63
Hey guys,

Could not find posted question relatable.

I installed Varnish on the server manually.
The current plan is Nginx -> Varnish -> Httpd.

Initially, I got a redirect issue whenever I pointed nginx to varnish through the proxy_pass.
I contacted Liquid support and they solved this by turning of the Redirect from http to https in the Plesk admin. Not sure how safe this is.

My main problem now is that whenever I make changes to the nginx.conf in /var/www/vhosts/system/site1/conf/nginx.conf.
These are my changes under listen <ip> 443 location {}:
I can't figure out how to do it in plesk's Additional nginx directives for the site.
However, after 30 mins I believe the changes revert back to the original.
I do not want to set up these changes on every site.

So my question is, how do I make those changes permanently for selected sites?


Well without affecting ssl certificate renewal or anything.
Thanks for any response or advice.
 
Thanks much for the response.

I check the files on server.

It would seem the files I want to customize would be:
  • Bash:
    usr/local/psa/admin/conf/templates/default/server/nginxVhosts.php
That's where I saw the proxy pass configuration for nginx. I could be totally wrong.
Based on the configuration I see here: nginxDomainVirtualHost.php, doesn't seem like it would affect the proxy pass changes unless I'm wrong.
 
You don't necessarily need to create a custom template. I would avoid that because Plesk will update the templates and new features may not work.

Add the following in additional Nginx directives. The location will be matched before ``location /`` and will proxy_pass requests to the Varnish service:
Code:
location ~* /  {
    if ($scheme = http) {
        return 301 https://$host$request_uri;
    }
    proxy_set_header Ssl-Offloaded https;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_pass http://127.0.0.1:6081;
}

Proxy mode needs to be enabled, in order to build the Apache configuration files. I would disable Smart static files processing and Serve static files directly by nginx in order to get all requests to Varnish.
 
Back
Top