使用身份验证设置 Apache 代理 [英] Setting up an Apache Proxy with Authentication

查看:57
本文介绍了使用身份验证设置 Apache 代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要设置一个带有身份验证的代理来验证连接到互联网的应用程序的行为.

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

我正在尝试使用转发代理和身份验证来设置 Apache 安装,尽管我已经接近使其工作,但我想知道是否有更好的方法,因为配置相当深奥.

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?

是否还有其他已经配置好的选项?也许是一些 VM 或其他一些软件工具,而不是 Apache?

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

推荐答案

为了记录,这是我如何设置 apache 以用作具有基本身份验证的转发代理:

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

打开http.conf

Open http.conf

取消注释以下 LoadModule 指令以启用代理功能

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

将以下指令添加到 http.conf 以启用身份验证

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>

使用 htpasswd.exe 实用程序创建一个 password.file.放在Apache Root目录下

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

htpasswd.exe -c password.file username

使用与password.file 相同级别的文本编辑器创建一个group.file,内容如下

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

usergroup: username

然后运行 ​​apachectl restart 以获取配置更改.

Then run apachectl restart to pick up the configuration changes.

这篇关于使用身份验证设置 Apache 代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆