我有...
<VirtualHost example.com:80>
ServerAdmin webmaster@localhost
ServerName example.com
Redirect permanent / https://example.com/
</VirtualHost>
這會立即轉到...
<IfModule mod_ssl.c>
<VirtualHost example.com:443>
ServerAdmin webmaster@localhost
ServerName example.com
ServerAlias example.com
DocumentRoot /home/klyde/ror/exampledev/public
SSLCertificateFile /etc/apache2/ssl/certs/123abc.crt
SSLCertificateChainFile /etc/apache2/ssl/certs/gd_bundle-g2-g1.crt
SSLCertificateKeyFile /etc/apache2/ssl/private/examplekey.key
BrowserMatch ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLEngine on
SSLProxyEngine On
ProxyRequests On
<Proxy *>
AddDefaultCharset off
#Options Indexes FollowSymLinks
AllowOverride none
<RequireAny>
#<RequireAll>
# Require all granted
#</RequireAll>
<RequireAll>
Require host example.com
</RequireAll>
<RequireAll>
Require local
# Require ip 127.0.0.1
</RequireAll>
</RequireAny>
</Proxy>
ProxyPassReverseCookiePath / /
ProxyPass /errors/ !
ProxyPass /websockets ws://127.0.0.1:8675/
ProxyPassReverse /websockets ws://127.0.0.1:8675/
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
</VirtualHost>
</IfModule>
當我啟用...
Require all granted
一切正常。但該網站已被網路釣魚氾濫。我想...
Require host example.com
但這會導致日誌錯誤......
access check of 'example.com' to / failed, reason: unable to get the remote host name
我選擇此配置是因為我想停止 Apache 中的 SSL 和 ajp to Torquebox。這工作得很好,除非試圖保護網站。當然,帶有 Torquebox 的 Apache 可能不完全是可取的、可取的,等等。
主要問題 - 為什麼會出現“遠端主機名稱”錯誤。有任何想法嗎?
答案1
只有當遠端 IP 位址有記錄時,透過名稱確定遠端主機才有效PTR
,並非所有 IP 位址都如此。如果可以,請在Require
語句中使用 IP 位址。
您還可以使用基本身份驗證(最好透過 https)來限制存取。
proxy
如果您想要的只是proxypass
功能, 則不需要定義 a 。
如果您需要代理,請嘗試將代理限制在您的網域內。
<Proxy http://www.example.com/*>
....
</Proxy>
答案2
我想你可以使用
Require ip 127.0.0.1
使用來自伺服器的 IP 而不是本機 IP
答案3
如果您只是想開放並允許來自任何 IP 的請求,您可以使用:
Require all granted
您可以在這裡查看更多:https://serverfault.com/a/887196/468080