Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to set-up a password protected development version of a clients web site (Plone CMS driven).

The live site serves on port 7373, and is mapped to the public www port 80.

The 'dev' site serves on port 8383, and is mapped to port 8111.

I don't currently have access to the clients DNS records, so I can't set up a sub domain, but IP and different port numbers are fine.

However, I can't work out how to password protect the development site, whilst still serving the live site. I'm especially flummoxed by the protection settings seeming to be for folders only, not sites?

Below is the best guest I have (based on my rather lacking apache-foo), but this only serves the live site, not the dev site, or fire the password!

<VirtualHost *:80>
 ServerAlias www.site.com

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

  ProxyPreserveHost On
  ProxyPass / http://localhost:7373/VirtualHostBase/http/site.com:80/plonesite/VirtualHostRoot/
  ProxyPassReverse / http://localhost:7373/VirtualHostBase/http/site.com:80/plonesite/VirtualHostRoot/


</VirtualHost>

<VirtualHost 123.456.789.123:8111>

<Location /plonesitetest/>
  AuthType Basic
  AuthName "Dev Server"
  AuthUserFile "/home/admin/.htpasswd"
  Require valid-user
</Location>


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

  ProxyPreserveHost On
  ProxyPass / http://localhost:8383/VirtualHostBase/http/123.456.789.123:8111/plonesitetest/VirtualHostRoot/
  ProxyPassReverse / http://localhost:8383/VirtualHostBase/http/123.456.789.123:8111/plonesitetest/VirtualHostRoot/


</VirtualHost>
share|improve this question

4 Answers 4

up vote 2 down vote accepted

Your ProxyPass lines look a little confusing, having port numbers halfway through the URL. Is that really how the plone server is setup to handle the incoming request (port numbers in the file/dir names)?

The proxy stuff is very order specific. From a quick check of the apache docs, it looks like the ProxyPass lines are probably kicking in before the Location lines, which may be bypassing the authentication stuff. How about something like this:

<Location /plonesitetest/>
  AuthType Basic
  AuthName "Dev Server"
  AuthUserFile "/home/admin/.htpasswd"
  Require valid-user
  ProxyPass http://localhost:8383/VirtualHostBase/http/123.456.789.123:8111/plonesitetest/VirtualHostRoot/
  ProxyPassReverse http://localhost:8383/VirtualHostBase/http/123.456.789.123:8111/plonesitetest/VirtualHostRoot/
</Location>

This will proxy requests for http://123.456.789.123:8111/plonesitetest/ onto the plone site.

share|improve this answer
Respost:
<VirtualHost *:8282>
    ServerName www.gpscoder.com
    ProxyPass / http://www.gpscoder.com:8080/
    ProxyPassReverse / www.gpscoder.com:8080/
    ProxyPreserveHost on
    <Proxy *>
        AuthType Basic
        AuthName "Dev Server"
        AuthUserFile "/var/www/xxxxxxx/.htpasswd"
        Require valid-user
    </Proxy>
</VirtualHost>
share|improve this answer

Live site

<VirtualHost *:80>
    ServerName siteurl.com
    DocumentRoot "/path/to/live/site"
    ProxyPreserveHost On
    ProxyRequests Off
    Proxypass / http://siteurl.com:7373/
    ProxypassReverse / http://siteurl.com:7373/
</VirtualHost>

Then for your dev site

<VirtualHost *:8111>
    ServerName siteurl.com
    DocumentRoot "/path/to/dev/site"
    ProxyPreserveHost On
    ProxyRequests Off
    Proxypass / http://siteurl.com:8383/
    ProxypassReverse / http://siteurl.com:8383/
    <Proxy *>
        AuthUserFile /home/admin/.htpasswd
        AuthType Basic
        AuthName "Dev Server"
        Require valid-user
    </Proxy>
</VirtualHost>
share|improve this answer

This will help.

1st result for Google: vhost password.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.