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
Best Answer
Configure your virtual host file as follow