配置虚拟主机并更改Apache默认解析路径

来源:互联网 发布:qq群关系数据库 编辑:程序博客网 时间:2024/06/05 14:54

在windows下配置虚拟主机,很简单

修改下面文件:



添加下面几句话

<VirtualHost *:80>    ##ServerAdmin webmaster@dummy-host2.example.com    DocumentRoot "D:/XAMPP/htdocs/shop/"    ServerName web.shop.com    ##ErrorLog "logs/dummy-host2.example.com-error.log"    ##CustomLog "logs/dummy-host2.example.com-access.log" common</VirtualHost>

打开hosts文件 

一般在这个路径上 


下面添加这几句话

127.0.0.1       web.yiiyongda.com      web.shop.com

就此结束。

进行测试:

访问这个文件


运行结果:


解析路径更改:

找到Apache 配置文件


修改后为:


在cent os  下:

在这个文件夹(vim /etc/httpd/conf/httpd.conf )下面添加到最后一行


NameVirtualHost 192.168.10.128:80<VirtualHost 192.168.10.128:80>ServerAdmin root@localhostDocumentRoot /var/www/html/buyingfeiblog/1ServerName centos.blog.com#ErrorLog /var/www/html/log/blog_log/error_log#TransferLog /var/www/html/log/blog_log/access_log</VirtualHost>


1 0
原创粉丝点击