Apache vhosts to different servers and different ports


I have a Leap 42.1 for a webserver. It is the first point of contact coming from the outside. Behind it are some other web servers running on different ports. I would like to use vhosts to proxy the other servers. So i created for every service a different vhost file. They all look like this:

<VirtualHost *:80>
ServerName service.domain.something
ProxyPreserveHost On
ProxyPass / http://server2:666/
ProxyPassReverse / http://server2:666/

For sometime (an hour or two) everything was working fine, and whenever i was going to the service.domain.somethign it was actually working fine. But then for no reason (there is NOTHING in the error log), all my vhosts (e.g. service.domain.something, service1.domain.something etc) start all resolving to service9.domain.something, instead of each to its own vhost.

As i said, there is nothing in the logs and i don’t know why they are doing this.

i used a2enmod for proxy and proxy_http and the modules are in both loadmodule.conf and sysconfig/loadmodule.conf

Any help would be appreciated.

If possible (eg setting up Apache to proxy for other websites)

I recommend installing and using the YAST HTTP Server applet to create and maintain your websites.
You’ll be able to easily set your vhost addresses and ports accordingly.

If you don’t already see it in YAST, you can install with the following command

zypper in yast2-http-server


Thank you.

The issues i have been having with the yast2 module for apache is that doesn’t support all the options and when you make a change on the files, it doesn’t like it. It deletes any changes you have made manually. I would prefer to find why the vhosts worked for a bit and then suddently stopped working.

Maybe I did some wrong configuration?

Hard to say.
e2enmod is a script designed for Apache running on Debian.
Depending on what the script does, it may work on other distros or it might not.

IIRC awhile back, at least for the Ubuntu version I was running compared to openSUSE, vhosts were setup and defined <very> differently. If I were you, I might consider looking at the scripts to see how reliant they are on setting up and hard paths that might exist to vhost definition files, and perhaps comment them out leaving only code configuring the apache modules. Then set up your vhosts using the YAST http-server applet. (probably reverse the order).

But, that’s pure speculation before likely wanting to find some other solution than e2nmod.