• 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 Setup reverse proxy(apache2 or nginx)

TheDanniCraft

New Pleskian
I've running a server with backend that should be accesed with an reversed proxy.
I've created a new .conf file in /etc/apache2/sites-availabe then I entered the following config:
<VirtualHost _default_:80> ServerName panel.example.com ProxyPreserveHost On ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ RewriteEngine on RewriteCond %{HTTP:Upgrade} websocket [NC] RewriteCond %{HTTP:Connection} upgrade [NC] RewriteRule .* ws://localhost:8080%{REQUEST_URI} [P] </VirtualHost>
and copied it into /etc/apache2/sites-enabled.
Then I restarted apache.

But when I open the url only the deafault page appeared.

Now ive seen that Plesk has a nginx reverse proxy pluggin. I downloaded and installed it.
Only in the folder where the nginx files are located, the corresponding order(sites-availibe and sites-enabled) is missing.

Now I do't know how to setup the reverse proxy.
 

Attachments

  • 52CE1553-DA26-4CDD-B6FA-34341E203383.jpeg
    52CE1553-DA26-4CDD-B6FA-34341E203383.jpeg
    407.4 KB · Views: 10
I would recommend you to setup the reverse proxy without plugin, as it is easier.
Just go into the "additional apache and nginx settings" for your (sub)domain and enter the following to the "additional nginx directives" (at the bottom):
Code:
location / {
    proxy_pass http://127.0.0.1:9091/;
}
Just replace the 127.0.0.1 with your target server's ip and the 9091 with the desired port.

Don't forget to set up a ssl certificate on the target server too, without your data will be transferred between your plesk server and the target server unencrypted (which isn't bad if you limit the access to the port only to your plesk server by the firewall).
 
I would recommend you to setup the reverse proxy without plugin, as it is easier.
Just go into the "additional apache and nginx settings" for your (sub)domain and enter the following to the "additional nginx directives" (at the bottom):
Code:
location / {
    proxy_pass http://127.0.0.1:9091/;
}
Just replace the 127.0.0.1 with your target server's ip and the 9091 with the desired port.

Don't forget to set up a ssl certificate on the target server too, without your data will be transferred between your plesk server and the target server unencrypted (which isn't bad if you limit the access to the port only to your plesk server by the firewall).
This gives me this error:
Ungültige nginx-Konfiguration: nginx: [emerg] duplicate location "/" in /var/www/vhosts/system/panel.thedannicraft.de/conf/vhost_nginx.conf:1 nginx: configuration file /etc/nginx/nginx.conf test failed
 
This gives me this error:
Ungültige nginx-Konfiguration: nginx: [emerg] duplicate location "/" in /var/www/vhosts/system/panel.thedannicraft.de/conf/vhost_nginx.conf:1 nginx: configuration file /etc/nginx/nginx.conf test failed
Sorry, I forgot to mention you have to disable the "Proxy mode" within the additional apache & nginx settings" (a little above).
 
Back
Top