搜尋

首頁  >  問答  >  主體

ubuntu - apache代理問題

系統環境:
  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/
但還是不行。

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

大家讲道理大家讲道理2856 天前1147

全部回覆(0)我來回復

無回覆
  • 取消回覆