• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • 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.

Resolved Changing domain vhost port for Apache and nginx in Plesk

s.kazimierczak

New Pleskian
Server operating system version
CentOS Linux 7.9.2009 (Core)
Plesk version and microupdate number
Obsidian 18.0.46 Update #2
Hi guys,
Is there a way to change the default port number for Apache and nginx in Plesk Additional Apache & nginx directives?
Changing this value in httpd.conf for vhost will be replaced with any change in Plesk. I want to only change the port for one website. I don't want to create custom templates because I don't want any future websites to use different ports than default ones.
Can anyone help?
Thanks in advance
 
this cannot be done

well, if I think a bit outside the box....
you could create an "Event Handler" in Plesk, that fires on domain updates and executes a shell script that does use something like awk/sed to search and replace the ports in the nginx and apache2 config file of this specific website and then reloads the nginx/apache2 service.
This way it would re-apply your custom ports again, any time you make some changes
 
Hi guys,
Is there a way to change the default port number for Apache and nginx in Plesk Additional Apache & nginx directives?
Changing this value in httpd.conf for vhost will be replaced with any change in Plesk. I want to only change the port for one website. I don't want to create custom templates because I don't want any future websites to use different ports than default ones.
Can anyone help?
Thanks in advance
Did you ever find a solution for this, needing to do something exactly like this?
 
This can be easily solved by a case switch in the template file, e.g. "if ... then".
Is there a way to do this when the domain is already added to Plesk. Or is there a way to change the current configuration for the reverse proxy set up where Apache uses 7081 and nginx uses 443 and change that to make nginx look for 3000 (as an example).
 
Never mind I figured out a solution:
Just went to the specific domain that I wanted changed and disabled nginx proxy mode and then under additional nginx directives in put the following

Code:
location / {
    proxy_pass https://my.ip.addr.here:3000;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
 
Back
Top