• 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

Question How can I permanently remove Nginx from Port 80?

Lethalmiko

New Pleskian
The Plesk documentation and other online discussion threads say that to change the listening ports of the webserver, you use templates, but all the instructions to change the port Nginx listens on have failed to remove it from port 80. All they do is add an extra port for listening to. I use Nginx as a frontline server (not as a reverse proxy to Apache). The instructions say to make copies of 6 Nginx template files and put them into a custom directory and edit them. ie

# mkdir /usr/local/psa/admin/conf/templates/custom/
# cp /usr/local/psa/admin/conf/templates/default/nginx* /usr/local/psa/admin/conf/templates/custom/
# mkdir /usr/local/psa/admin/conf/templates/custom/webmail/
# cp /usr/local/psa/admin/conf/templates/default/webmail/nginxWebmail.php /usr/local/psa/admin/conf/templates/custom/webmail/

List of files to edit:

nginxDomainForwardingIpDefault.php
nginxDomainForwarding.php
nginxDomainVhostIpDefault.php
nginxDomainVhost.php
nginx.php
nginxWebmail.php

I looked for the line:

'ssl' => false,
'frontendPort' => $VAR->server->nginx->httpPort,

Changed to this:

'ssl' => false,
'frontendPort' => "8888",

Then:

# /usr/local/psa/admin/bin/httpdmng --reconfigure-all
# /etc/init.d/nginx restart

But after all this, Nginx still binds to port 80. All the instructions on the threads I found online (including the Plesk forums) on this topic simply DO NOT WORK!!!

eg this thread: [Solved] help required - change nginx port

Here is what happens:

# netstat -nlpt | grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 30019/nginx: master
tcp 0 0 x.x.x.x:8888 0.0.0.0:* LISTEN 30019/nginx: master
tcp 0 0 x.x.x.x:443 0.0.0.0:* LISTEN 30019/nginx: master

I use ‪Ubuntu 18.04.3 LTS‬ and Plesk Onyx 17.8.11 Update #81.

Someone please HELP!!!
 
Last edited:
It turns out that all the instructions for changing the listening port for either Apache or Nginx do not work. For example this guide in the documentation doesn't work:


I disabled Nginx from the Plesk Panel, then changed the Apache port in 14 files as per instructions. Regenerated system files, restarted Apache but it still blocks Port 80. If I stop Apache and start a caching server in front of it on port 80, Apache refuses to start. List of custom template files:

/usr/local/psa/admin/conf/templates/custom/domain/domainVirtualHost.php
/usr/local/psa/admin/conf/templates/custom/domain/frameForwarding.php
/usr/local/psa/admin/conf/templates/custom/server/mailman.php
/usr/local/psa/admin/conf/templates/custom/server/nameVirtualHost.php
/usr/local/psa/admin/conf/templates/custom/nginx.php
/usr/local/psa/admin/conf/templates/custom/nginxDomainForwarding.php
/usr/local/psa/admin/conf/templates/custom/nginxDomainForwardingIpDefault.php
/usr/local/psa/admin/conf/templates/custom/nginxDomainVhost.php
/usr/local/psa/admin/conf/templates/custom/nginxDomainVhostIpDefault.php
/usr/local/psa/admin/conf/templates/custom/webmail/nginxWebmail.php
/usr/local/psa/admin/conf/templates/custom/server/pleskServiceLocaldomain.php
/usr/local/psa/admin/conf/templates/custom/domain/standardForwarding.php
/usr/local/psa/admin/conf/templates/custom/server/vhosts.php
/usr/local/psa/admin/conf/templates/custom/webmail/webmail.php

I really don't understand why instructions that don't work have been put into official documentation. :(
 
Back
Top