ubuntu - apache代理問題
大家讲道理
大家讲道理 2017-04-24 09:12:24
0
0
1094

系統環境:
  ubuntu12.04 apache 2.4.12

想嘗試代理問題,想用80埠代理8081埠服務:
使用虛擬主機,設定檔如下:

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/

<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 '/':

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

查看到是設定檔的問題,修改認證的檔案:
AuthUserFile /home/gerrit/review/etc/gerrit.passwd/
但還是不行。

大神幫忙看看我哪裡配置錯誤了又或者是我根本就沒理解正向代理和反向代理的原理,求指導!不甚感謝!

大家讲道理
大家讲道理

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

全部回覆(0)
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板