Report this

What is the reason for this report?

Setting up Vhosts with apanche2 on ubuntu 20.04

Posted on March 9, 2022

Steps taken a) get a droplet with plesk from digital ocean b) create a conf file in /etc/apache2/sites-available/ c)add the custom ports on /etc/apache2/ports.conf d)Enable the conf file with apache a2ensite e) restart apache2

We have been trying to set up virtual hosts on apache2 for my ubuntu digital ocean droplet so that it can pick up ssl on ports.What we mean is we would like different users to access my application on ports for example one client would be on example.com:3490 another would be on example.com:3491 . We are utilizing proxy pass and reverse proxy.We are using this config for our vitual host with conf file

<IfModule mod_ssl.c> <VirtualHost *:2095> ServerName example.com ServerAlias * DocumentRoot /var/www/html SSLProxyEngine on SSLEngine On SSLCertificateFile /etc/ssl/certs/example.com.pem SSLCertificateKeyFile /etc/ssl/private/example.com.key

<Proxy *>
    Allow from all
</Proxy>

ProxyPass / http://serverIP:1095/
ProxyPassReverse / http:/serverIP:1095/
ProxyPreserveHost On
RequestHeader set X-Forwarded-Proto: "https"
</VirtualHost>
</IfModule>

/////////////////////////////////////////////////////// we then add the ports to the ports.conf file and enable the site using apache a2ensite however when we try access the domain example.com:2095 we get an error but if we go to example.com the domain is present and fully secured so we do not get what we are doing wrong Lastly we also have a plesk panel on this droplet

we have checked my apache2 logs and everything seems fine kindly help



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Heya,

There are a few things you can check in order to troubleshoot the issue here.

  1. Check if the custom ports are open on your firewall in the DigitalOcean droplet. You should edit your firewall rules to allow incoming traffic to the ports you are using. For Ubuntu, you can use UFW to manage your firewall rules. If you are using Plesk, you can configure the firewall from the Plesk panel.

  2. Ensure that you restart the Apache2 service after making any changes, by running:

  1. sudo systemctl restart apache2
  1. In your VirtualHost block, try changing the ServerAlias directive to default:*" instead of *.

If you’re still having issues, I suggest you follow this guide on setting up Apache Virtual Hosts on Ubuntu.

For more information related to Plesk and DigitalOcean integration, please refer to Plesk on DigitalOcean documentation.

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.