简体   繁体   English

使用身份验证设置Apache代理

[英]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. 我需要设置一个带身份验证的代理来验证连接到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. 我正在尝试使用转发代理和身份验证来设置Apache安装,即使我接近使其工作,我想知道是否有更好的方法,因为配置相当深奥。

How can Apache be configured to work this way? Apache如何配置为以这种方式工作?

Is there any other good option that is already configured? 还有其他已经配置好的选项吗? Maybe some VM or some other software tool, instead of Apache? 也许是一些VM或其他一些软件工具,而不是Apache?

For the record, this is how I set up apache to be used as a forward-proxy with basic authentication: 为了记录,这就是我如何设置apache以用作具有基本身份验证的转发代理:

Open http.conf 打开http.conf

Uncomment the following LoadModule directives to enable proxy funcionality 取消注释以下LoadModule指令以启用代理功能

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 将以下指令添加到http.conf以启用身份验证

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. 使用htpasswd.exe实用程序创建password.file。 Place it on the Apache Root directory 将它放在Apache Root目录中

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 使用与password.file相同级别的文本编辑器创建group.file,其中包含以下内容

usergroup: username

Then run apachectl restart to pick up the configuration changes. 然后运行apachectl restart以获取配置更改。

I use Squid . 我用鱿鱼

It's quite easy to install it and to setup it with a basic authentication with the "auth_param" directive in the configuration file. 安装它并使用配置文件中带有“auth_param”指令的基本认证来设置它非常容易。

You will find some samples , understand how it works , and all details about the auth_param on Squid Website 您将找到一些示例了解它是如何工作的 ,以及有关Squid网站上的auth_param的所有详细信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM