• 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 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: 9
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