我不知道如何在我的服务器上使用 mod_proxy。我在 中进行了如下配置httpd.conf
:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName mysite.com
ServerAlias www.mysite.com
DocumentRoot /var/lib/tomcat/webapps/
<Proxy *>
AddDefaultCharset Off
Order deny,allow
Allow from all
</Proxy>
</VirtualHost>
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / http://mysite.com:8080/
ProxyPassReverse / http://mysite.com:8080/
ServerName www.mysite.com
</VirtualHost>
怎么了?
答案1
如何正确使用 Apache 代理的示例:
#you need these:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
#main config
<VirtualHost *:80>
ServerName dev.ionfish.org
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://other.site.com:80/
ProxyPassReverse / http://other.site.com:80/
<Location />
Allow from all
</Location>
</VirtualHost>