9

My roommate and I each have a separate webserver we are trying to set up. We are trying to use mod_proxy so that his server will forward requests to my machine (we have two seperate machines behind one router) based on the server name. I've given the basics of what we have in our apache config currently but we are getting a 403 Forbidden error when trying to access the second domain (the first, www domain, works fine).

NameVirtualHost *:80

<VirtualHost *:80>
 DocumentRoot /var/www
 ServerName www.<domain1>.com
</VirtualHost>

<VirtualHost *:80>
 ProxyPreserveHost On
 ProxyPass / http://<IP addr of other box>:80
 ProxyPassReverse / http://<IP addr of other box>:80
 ServerName <dummydomain>.gotdns.com
</VirtualHost>

2 Answers 2

17

Your mods-enabled/proxy.conf might be blocking any proxy requests (it's deny all by default). It should include the following instead:

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

EDIT: Also make sure that the mod_proxy submodules are sym linked into mods-enabled (in this case, the http sub module which is mods-available/proxy_http.load)

Sign up to request clarification or add additional context in comments.

6 Comments

Just tried this and started to get an Internal Server error instead. any ideas about issues?
What does the apache log say?
Updated the answer with what I'm guessing is the next problem
Got it to work. had to allow proxy requests and then didn't have proxy_http enabled. but we got it. Thanks for the help!
Hi @Pete, I still getting internal server error. could you tell me where proxy_http location ? thank you in advance...
|
0

Just put both routes:

<VirtualHost *:80>
    DocumentRoot "/app/"
    ProxyPreserveHost On
    ProxyRequests Off
    ServerName app.yourdomain.com

    ProxyPass /app http://yourIP:yourPort/app/
    ProxyPassReverse /app http://yourIP:yourPort/app/

    ProxyPass / http://yourIP:yourPort/app/
    ProxyPassReverse / http://yourIP:yourPort/app/
</VirtualHost>

<Location "/app/" >
    ProxyPass "http://yourIP:yourPort/app/"
    ProxyPassReverse  "http://yourIP:yourPort/app/"
    ProxyPassReverseCookiePath  "/app/"  "/app/"
    ProxyHTMLEnable Off
    ProxyHTMLExtended On
    ProxyHTMLURLMap "/app/" "/app/"
    Order allow,deny
    Allow from all
</Location>

This worked form me

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.