I am using apache to setup a virtualhost for my two angular projects, i wanted one of them to be in a subdirectory of the main host, after setup the apache and everything, i changed my httpdvhost.conf file and it looks like this right now:
<VirtualHost *:80> ServerName http://local.example.com ProxyPass /chat http://localhost:8100 ProxyPassReverse /chat http://localhost:8100 ProxyPass / http://localhost:4200/ ProxyPassReverse / http://localhost:4200/ </VirtualHost>
My problem is that my project at port 8100 can't get it's css files as it looks for main.css for example at the path http://local.example.com/build/main.css instead of looking for it in the path http://local.example.com/chat/build/main.css.
is there any solution for that ? I am a total beginner in this area so i can't find one.
According to the documentation http://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass your configuration seems to be correct except for a "/". Change your configuration as following:
<VirtualHost *:80> ServerName http://local.example.com ProxyPass /chat/ http://localhost:8100/ ProxyPassReverse /chat/ http://localhost:8100/ ProxyPass / http://localhost:4200/ ProxyPassReverse / http://localhost:4200/ </VirtualHost>
moreover add some logging to the virtualhost to find out what's happening: https://httpd.apache.org/docs/2.4/logs.html.
1.4m articles
1.4m replys
5 comments
57.0k users