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 wish to create a password protected vhost for selected clients (clients.mysite.com)

We have a windows reverse proxy with some vhosts (www, static, secure). I am not using htaccess files as this is a reverse proxy and website is served by another back end server

How could I set up a password? I am using .conf files for our vhosts

share|improve this question
add comment

1 Answer

I would imagine it could be done the same way you would protect a normal directory

<VirtualHost site:80>
    ServerName ...
    <Location /proxypath/>
        AuthType Basic
        AuthName "Restricted Files"
        AuthUserFile /usr/local/apache/passwd/passwords
        Require user rbowen
    </Location>

    ProxyPass /proxypath/ ...
</VirtualHost >

Then use the htpasswd utility to generate a .htpasswd file

share|improve this answer
    
Thank for your help, but Apache won't restart with this... <virtualHost *> ServerName test3.mysite.com ServerAlias test3.mysite.com ServerAlias 192.168.1.250 ServerAdmin webmaster@mysite.com DirectoryIndex index.htm ProxyPass /cgi-vel/web/ localhost:82/cgi-vel/web keepalive=on ProxyPass / localhost:82/cgi-vel/web keepalive=on ProxyPassReverse / localhost:82/cgi-vel/web keepalive=on ProxyPreserveHost On ErrorLog "logs/test_web_error.log" CustomLog "logs/test_web-access.log" combined </virtualHost> –  Raul Taboraz Nov 23 '11 at 10:43
    
@RaulTaboraz Does it give you an error? –  sam Nov 23 '11 at 10:51
    
yes, apache does not start... I am sorry for delay and wrong code. I have really solved today, adding password required to "static" vhost, not reverse proxy. Thank you anyway –  Raul Taboraz Nov 27 '11 at 19:25
add comment

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.