1

We have the following scenario:

  • First APP: http://example.com:8090/access/app1
  • Second APP: http://example.com:8090/access/app2

We want to configure apache mod_proxy to assign:

  • http://app1.example.com >> http://example.com:8090/access/app1
  • http://app2.example.com >> http://example.com:8090/access/app2

We tried the following without success:

<VirtualHost app1.example.com:80> ServerName app1.example.com ProxyPass / http://example.com:8090/access/app1/ ProxyPassReverse / http://example.com:8090/access/app1/ </VirtualHost> <VirtualHost app2.example.com:80> ServerName app2.example.com ProxyPass / http://example.com:8090/access/app2/ ProxyPassReverse / http://example.com:8090/access/app2/ </VirtualHost> 

Saved this into /etc/httpd/conf.d/myconfig.conf, then restart apache sudo service http restart.

When using a browser and writting http://app1.example.com the default Apache-Welcome-Page appears, but not our app1 page. Looks like the mod_proxy config is not working.

Setting errorlevel to DEBUG will show the following event in error_log:

[Tue Aug 07 14:18:04.748775 2018] [autoindex:error] [pid 1985] [client x.x.x.x:58843] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive

Any help will be appreciated

1
  • 1
    Typically I use <VirtualHost *:80> rather than <VirtualHost app1.example.com:80> for name based virtualhosts Commented Aug 7, 2018 at 12:35

2 Answers 2

0

Configure your virtual host file as follow

<VirtualHost *:80> ServerName app1.example.com ProxyPass /app1 http://example.com:8090/access/app1/ ProxyPassReverse /app1 http://example.com:8090/access/app1/ </VirtualHost> <VirtualHost *:80> ServerName app2.example.com ProxyPass /app2 http://example.com:8090/access/app2/ ProxyPassReverse /app2 http://example.com:8090/access/app2/ </VirtualHost> 
0

Two things:

1) comment out or empty the conf.d/welcome.conf file (do not remove it though, or it will get reinstated when you next patch httpd

2) httpd -S is a great friend when considering virtual server issues. This will output where in your configuration your virtualhosts are defined (and which ones are default)

And a bonus: I see you are using port 8090, which makes me think you are possibly dealing with Atlassian products. If you are dealing with Confluence with the Synchrony collaborative editing component, I can perhaps give you some config for the websocket stuff (Atlassian’s documentation is confusing when it comes to reverse proxy configuration )

2
  • Thanks for your time, we proceeded as suggested in point 1 (emptying welcome.conf). Now we don't see the default-welcome-page, but the contets of ` /var/www/html/` folder. That means that our mod_proxy config still not redirecting to our servers. Here is the output for httpd -S: pastebin.com/GnJgpqtL Commented Aug 8, 2018 at 11:32
  • Please put the extra information into your question; it makes it easier for other people to find and solve problems. If app1.example.com and app2.example.com don't resolve to 127.0.0.1, then based on your httpd -S output, your issue will be that you don't have your VirtualHost listening on the interface the request is coming in on. Try <VirtualHost *:80> instead. Commented Aug 8, 2018 at 19:27

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.