• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

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