我有一个服务器只有一个IP地址,但很多域(和子doman),但每个域都有我的主机服务器上的专用虚拟机 .

我尝试将mod_proxy用于ProxyPass和Reverse请求,并在apache conf中我做到:

<VirtualHost *:80>
        ServerAlias mydomain.domain.com
        ProxyRequests Off
        <Proxy />
                Order deny,allow
                Allow from all
                ProxyPass http://192.168.1.8/
                ProxyPassReverse http://192.168.1.8/
        </Proxy>
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        ErrorLog ${APACHE_LOG_DIR}/error.log
</VirtualHost>

<VirtualHost *:80>
        ProxyRequests Off
        ServerAlias domain.domain2.org
        ServerAlias subdomanin.domain.com
        DocumentRoot /var/www
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        ErrorLog ${APACHE_LOG_DIR}/error.log
</VirtualHost>

在此conf:

domain.domain1.com -> go to 192.168.1.8
subdomanin.domain1.com and another domain  -> go to document root.

使用ProxyRequests和“全部允许”(此conf),apache是一个openproxy ...使用此配置(和ProxyRequest Off),如果有人通过代理mydomain.domain.com请求“www.google.it”他不会有谷歌,但服务器将其重定向到myNumericIp

什么是正确的配置如果http://mydomain.domain.com/some请求重定向到myNumericIp与url http://my.Numeric.Ip/some otherwhise代理没有响应任何东西) .

我试试这个:

<Proxy http://mydomain.domain.com/>
        Order deny,allow
        Allow from all
        ProxyPass http://192.168.1.8/
        ProxyPassReverse http://192.168.1.8/
</Proxy>

或这个:

<Proxy />
        Order deny,allow
        Allow from all
        ProxyPass http://192.168.1.8/
        ProxyPassReverse http://192.168.1.8/
</Proxy>
<Proxy *>
        Order deny,allow
        Deny from all
</Proxy>

但是不要工作......