• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

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