Can someone help me with this issue please. On my windows server, I have published a website made with wordpress with apache on port 80 (www.mysite.com). On the other hand, I have another web site on the same server and it is published on IIS port 8001 (as localhost:8001).
I need my www.mysite.com/subsite subdomain to point to localhost:8001. I have tried something like:
<VirtualHost *: 80>
ServerName www.mysite.net
ServerAlias mysite.net
ProxyRequests on
<Location />
ProxyPass "http://localhost:8001/"
ProxyPassReverse "http://localhost:8001/"
</Location>
</VirtualHost>
I have also tried with:
<virtualHost *: 80>
DocumentRoot \www\mysite\subsite
ServerName "http://localhost:8001/"
</virtualHost>
In both cases it doesn't work for me. Can someone help me please, I'm new to this apache configuration
Thanks a lot in advance
Don't enable ProxyRequests for a reverse proxy, this is only needed for a forward proxy (default is Off
).
Remove the space before 80
and add ProxyPass
and ProxyPassReverse
like this:
<VirtualHost *:80>
ServerName www.mysite.net
ServerAlias mysite.net
ServerAlias www.mysite.com
ProxyPass /subsite http://localhost:8001
ProxyPassReverse /subsite http://localhost:8001
</VirtualHost>
I added ServerAlias www.mysite.com
since you mentioned that this is your domain (or swap ServerName
and ServerAlias
with www.mysite.net
).
If you want to proxy the requests only for www.mysite.com
, you can use two VirtualHosts:
<VirtualHost *:80>
ServerName www.mysite.net
ServerAlias mysite.net
</VirtualHost>
<VirtualHost *:80>
ServerName www.mysite.com
ProxyPass /subsite http://localhost:8001
ProxyPassReverse /subsite http://localhost:8001
</VirtualHost>
You may also want to add logging using the ErrorLog
and CustomLog
directives (copy and adapt the lines from the default configuration).
You need to enable modules mod_proxy
and mod_proxy_http
in your server and restart Apache.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.