• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

[Solved] help required - change nginx port

Imad S

New Pleskian
Hey,

I need help in changing the nginx port. I've followed various threads and have created a custom nginxDomainVirtualHost.php file at: /usr/local/psa/admin/conf/templates/custom/domain, while the website indeed moves to the port I have set, a second nginx thread starts at port 80 and takes over in it's place.

I need to put varnish at port 80 and cannot do so until all services relinquish control on port 80.

Help please.

Solved!

Followed clues here:
http://download1.parallels.com/Ples...nistration-guide/index.htm?fileName=68800.htm

some here:
http://talk.plesk.com/threads/step-...and-integrate-varnish-with-plesk-12-x.310544/

Turn's out to be able to change the nginx port to a non-standard port you need to edit 6 files
  • nginx.php
  • nginxDomainForwarding.php
  • nginxDomainForwardingIpDefault.php
  • nginxDomainVhost.php
  • nginxDomainVhostIpDefault.php
  • nginxWebmail.php

For the time being i disabled SSL support for my test domain as I didn't need it. The line you need to look for the in above files is:
Code:
$VAR->server->nginx->httpPort

So the line would finally become from this:
Code:
<?php echo $VAR->includeTemplate('server/nginxVhosts.php', array(
    'ssl' => false,
    'frontendPort' => $VAR->server->nginx->httpPort,
    'backendPort' => $VAR->server->webserver->httpPort,
)) ?>

to this:
Code:
<?php echo $VAR->includeTemplate('server/nginxVhosts.php', array(
    'ssl' => false,
    'frontendPort' => "8888",
    'backendPort' => $VAR->server->webserver->httpPort,
)) ?>

To get this to work you'll need to create a custom directory at: /usr/local/psa/admin/conf/templates
and copy the files over from the root of /usr/local/psa/admin/conf/templates/default


Hope this helps someone.
 
Last edited:
Back
Top