ubuntu - apache代理问题
大家讲道理
大家讲道理 2017-04-24 09:12:24
[Linux讨论组]

系统环境:
  ubuntu12.04 apache 2.4.12

想尝试代理问题,想用80端口代理8081端口服务:
使用虚拟主机,配置文件如下:
<VirtualHost *:80>

DocumentRoot /home/gerrit/review
ServerName localhost 
ErrorLog  /home/gerrit/review/logs/review-error.log
CustomLog /home/gerrit/review/logs/review-common.log common 
ProxyRequests Off  
ProxyVia Off  
ProxyPreserveHost On  
AllowEncodedSlashes On  
RewriteEngine On  
#RewriteRule ^/(.*) http://192.168.9.204:8081/$1

<Proxy *>  
      Order deny,allow  
      Allow from all  
</Proxy>  

<Location /login/>  
    AuthType Basic  
    AuthName "Gerrit Code Review"  
    Require valid-user  
    AuthBasicProvider file  
    AuthUserFile /home/gerrit/review/etc/gerrit.passwd 
</Location>  

ProxyPass / http://192.168.9.204:8081

</VirtualHost>

但是在重启apache的时候没有报错,但是apache没有启动。(查看 ps -ef | grep httpd -->没有回显信息)

在网页中查看80端口没有跳到8081上,直接访问8081返回界面信息如下:

Configuration Error

Check the HTTP server's authentication settings.
The HTTP server did not provide the username in the Authorization header when it forwarded the request to Gerrit Code Review.

If the HTTP server is Apache HTTPd, check the proxy configuration includes an authorization directive with the proper location, ensuring it ends with '/':

<VirtualHost 192.168.9.204:8081>

ServerName 192.168.9.204

ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On

<Proxy *>
      Order deny,allow
      Allow from all
</Proxy>

<Location /login/>
  AuthType Basic
  AuthName "Gerrit Code Review"
  Require valid-user
  ...
</Location>
AllowEncodedSlashes On
ProxyPass / http://.../ nodecode

</VirtualHost>

查看到是配置文件的问题,修改认证的文件:
AuthUserFile /home/gerrit/review/etc/gerrit.passwd/
但是仍然不起作用。

大神帮忙看看我哪里配置错误了又或者是我根本就没理解正向代理和反向代理的原理,求指导!不甚感谢!

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

全部回复(0)
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号