相思资源网 Design By www.200059.com

安装apache,php:
yum install httpd php

假设VPS的IP是58.130.17.168,有两个域名指向该IP,分别是domain1.com, domain2.com,

修改/etc/httpd/conf/httpd.conf,在文件的最后加入:

ServerName 58.130.17.168
NameVirtualHost 58.130.17.168

<VirtualHost 58.130.17.168>
        ServerName domain1.com
        DocumentRoot /var/www/domain1.com
        <Directory "/var/www/domain1.com">
            Options Indexes FollowSymLinks
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost>

<VirtualHost 58.130.17.168>
        ServerName domain2.com
        DocumentRoot /var/www/domain2.com
        <Directory "/var/www/domain2.com">
            Options Indexes FollowSymLinks
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost>

然后在/var/www/domain1.com和/var/www/domain2.com下创建不同的index.html文件:
echo "domain1">/var/www/domain1.com/index.html
echo "domain2">/var/www/domain2.com/index.html

在浏览器里输入http://domain1.com和http://domain2.com即可看到效果了
 

标签:
虚拟主机,实例,配置,系统, ,<,",>,58.130.17.168

相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com

评论“linux系统配置Apache虚拟主机实例”

暂无linux系统配置Apache虚拟主机实例的评论...