Question

domain with subdirectory

Posted August 29, 2018 771 views
ApacheDebian

hi..

i have 2 apache server…
server1 can be access by public. www.example.com.
server2 is a local server

on server1 i have other web directory. www.example.com/web1 , www.example.com/web2

i am using alias /web1 to make client can access www.example.com/web1

i have make new content on server2 for web1
from local network i can access the newweb1 using http://ipserver2/newweb1

so now how can i make client from public to access newweb1 using url www.example.com/web1

i have try using proxypass but the hyperlink inside newweb1 is point to ip address for local server2.

tq

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.

×
2 answers

i already include inside apache server1 config

 ProxyPreserveHost on
 ProxyPass /web1 http://server2ip/newweb1
 ProxyPassReverse /web1 http://server2ip/newweb1

i'am using Joomla 3.8

newweb1 can be access by url www.example.com/web1 but the hyperlink inside the web is refer to the local ip address.

Thank you in advanced

Hey friend!

You are on the right path with proxypass, reverse proxy is how you handle the task at hand. The reason the links are going to the IP is that the site at IP/newweb1 is configured that way. I’m betting it’s a Wordpress site, those hard code their URL into them when set up. It can be changed though, and there are some steps for doing so here:

https://codex.wordpress.org/Changing_The_Site_URL

If I’ve made a wrong assumption, let me know :)

Jarland

Submit an Answer