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.

This is what I have so far:

<VirtualHost *:80>
DocumentRoot "/PathToTheFilesThat/theserver/gives/access/to"
ServerName docs.mysite.com
ProxyPass / http://localhost:8808/
ProxyPassReverse / http://localhost:8808
</VirtualHost>

Basically, I'm just trying to make a YARD documentation server public to the company I work for (but not to the entire world), hence the want for basic auth.

The above currently allows access to the server from any remote machine... just need auth. =D

UPDATE:

<VirtualHost *:80>
    DocumentRoot "/Users/me/projects/myProject/doc"
    ServerName docs.mysite.com
    ProxyPass / http://localhost:8808/
    ProxyPassReverse / http://localhost:8808
    AuthUserFile /private/etc/apache2/conf/.htpasswd
    AuthName "Documentation Server, Please Log In"
    AuthType Basic
    Require User me
</VirtualHost>

gives this error when I navigate to docs.mysite.com (in the console)

[Tue Feb 21 11:33:04 2012] [error] (61)Connection refused: proxy: HTTP: attempt to connect to [fe80::1]:8808 (localhost) failed
[Tue Feb 21 11:33:04 2012] [error] ap_proxy_connect_backend disabling worker for (localhost)
[Tue Feb 21 11:35:16 2012] [notice] caught SIGTERM, shutting down
share|improve this question
    
What exactly do you expect of the authentiation? Do you want a single username/password pair that you can give out to everyone? Basic auth can be sniffed by any packet analyzer, so it's not very secure. Are you looking for something better than that? Details, we need them. Security is not simple, no matter what. –  Chris S Feb 21 '12 at 15:24
    
yeah, a singel username / password that everyone would use would be great. I'm aware of the lack of security, but they would have to find it first, right? maybe I also need a way to keep search engine crawlers off of it. This is what I'm running: yardoc.org The server it comes with is not very featurefull. –  NullVoxPopuli Feb 21 '12 at 15:30
add comment

1 Answer

In order to enable User Authentication on your Webserver's entry point you must add the following lines to the VirtualHost configuration lines.

<VirtualHost>
..
..
..
..
..

    AuthUserFile /usr/local/apache2/conf/.htpasswd
    AuthName "yoursite.com, Please Log In."
    AuthType Basic
    Require User userallowedtoenter
</VirtualHost>

And by adding these lines, everytime you open the Website, an Auth Window will pop up asking for the user/password enabled to pass.

share|improve this answer
    
take note that, the AuthUserFile could be a different location on your machine. –  GersonO Feb 21 '12 at 15:32
2  
+1 Good form to capitalize Require User too, but this works either way. –  Chris S Feb 21 '12 at 15:32
    
already capitalized it ;) –  GersonO Feb 21 '12 at 15:42
1  
+1 always have hard time with .htpasswd with apache virtual host. –  Nic Young Feb 21 '12 at 15:57
2  
httpd.apache.org/docs/2.0/mod/mod_auth.html#authuserfile AuthUserFile howto. –  GersonO Feb 21 '12 at 16:03
show 3 more comments

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.