• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • 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.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Change website listening port

JanikoG

New Pleskian
Hi all,
I want to change the http port for only one of my website.
Example : I want to access to one website with http(s)://mywebsite:9999 instead of http(s)://mywebsite
I know I can change manually the nginx config files, but that kind of update is not permanent for the config file is automatically generated.
Any idea ?
 
Unfortunately it's not exactly what I meant: I want to keep the 80/443 for all my sites except for one of them for which I want to set 1111/1112 for example.
I could change it in /var/www/vhosts/system/<mydomain>/conf/nginx.conf but the configuration will be overwriten sooner or later.
 
You can define your special nginx settings with custom virtual host template Changing Virtual Hosts Settings Using Configuration Templates
But note that this solution will affect all your newly created sites.
I tried this method but it failed. I am using Nginx as a full front-line server (and not as a proxy to Apache). I wanted to install Varnish in front of Nginx so I tried to change the listening port for Nginx from 80 to 8800 using templates. It simply does NOT work, no matter what I do. Nginx always takes over port 80 and blocks Varnish from starting and it simultaneously begins listening on port 8800 as well.

I edited the following files, preserving the directory structure:

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

I changed the following lines in all the 6 files wherever it was occurring:

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

'ssl' => true,
'frontendPort' => $VAR->server->nginx->httpsPort,

Changed to this:

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

'ssl' => true,
'frontendPort' => "8801",

Here are the commands I used:

# 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/

And of course after all the changes I restarted Nginx but it still binds to port 80 and 8800 at the same time. So I had to delete the custom templates and revert to the original setup until I get proper answers or directions.

I am on ‪Ubuntu 18.04.3 LTS‬ and Plesk Onyx 17.8.11 Update #81
 
Customized templates will be applied only for newly created domains if I'm not mistaken. Have you checked this?
 
Customized templates will be applied only for newly created domains if I'm not mistaken. Have you checked this?
The domain is not new as it is an existing site. How will any new domain work since Nginx always takes over port 80 because the configuration is server-wide and not domain specific? Adding a new domain won't change the status of port 80. So what method can I use to remove Nginx from port 80?
 
Back
Top