ubuntu - apache代理问题
大家讲道理
大家讲道理 2017-04-24 09:12:24
0
0
1035

系统环境:
  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/
但是仍然不起作用。

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

大家讲道理
大家讲道理

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

Antworte allen(0)
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!