原创

使用Apache将多个域名配置到同一个IP的linux服务器上

如何将多个域名配置到同一个IP的linux服务器上

 

1.安装httpd

yum install httpd 

2.配置httpd.conf

 vim /etc/httpd/conf/httpd.conf 

ServerRoot "/etc/httpd"

Listen 80

LoadModule ssl_module modules/mod_ssl.so

LoadModule rewrite_module modules/mod_rewrite.so

Include /etc/httpd/conf.d/ssl.conf

Include conf.modules.d/*.conf

<Directory />

    Options FollowSymLinks

    AllowOverride None

    Order deny,allow

    allow from all

</Directory>

 

#域名一:

<VirtualHost *:80>

    ServerName test1.domain.cn

    ProxyRequests Off

    ProxyPreserveHost On

    <Proxy *>

    Order Deny,Allow

    Allow from all

    </Proxy>

    ProxyPass / http://xxx.xxx.xxx.xxx:8081

    ProxyPassReverse / http://xxx.xxx.xxx.xxx:8081

</VirtualHost>

 

#域名一:

<VirtualHost *:80>

    ServerName test2.domain.cn

    ProxyRequests Off

    ProxyPreserveHost On

    <Proxy *>

    Order Deny,Allow

    Allow from all

    </Proxy>

    ProxyPass / http://xxx.xxx.xxx.xxx:8082

    ProxyPassReverse / http://xxx.xxx.xxx.xxx:8082

</VirtualHost>

正文到此结束
本文目录