Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up an Apache Proxy with Authentication

I need to set up a proxy with authentication to verify the behavior of an application that connects to the internet.

I am trying to set-up an Apache installation with forward proxy and authentication, and even though I am close to make it work, I wonder if there is maybe a better way, as the configuration is fairly esoteric.

How can Apache be configured to work this way?

Is there any other good option that is already configured? Maybe some VM or some other software tool, instead of Apache?

like image 253
Mario Ortegón Avatar asked Apr 07 '09 08:04

Mario Ortegón


People also ask

Does Apache act as a proxy server?

In addition to being a "basic" web server, and providing static and dynamic content to end-users, Apache httpd (as well as most other web servers) can also act as a reverse proxy server, also-known-as a "gateway" server.


1 Answers

For the record, this is how I set up apache to be used as a forward-proxy with basic authentication:

Open http.conf

Uncomment the following LoadModule directives to enable proxy funcionality

LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so 

Add the following directives to the http.conf to enable authentication

ProxyRequests On ProxyVia On  <Proxy *>     Order deny,allow     Allow from all     AuthType Basic     AuthName "Password Required"     AuthUserFile password.file     AuthGroupFile group.file     Require group usergroup </Proxy> 

Create a password.file using the htpasswd.exe utility. Place it on the Apache Root directory

htpasswd.exe -c password.file username 

Create a group.file using a text editor at the same level as the password.file with the following contents

usergroup: username 

Then run apachectl restart to pick up the configuration changes.

like image 194
Mario Ortegón Avatar answered Oct 13 '22 21:10

Mario Ortegón