apache之虚拟服务器的配置

来源:互联网 发布:js字符串包含某个字符 编辑:程序博客网 时间:2024/05/05 23:46

配置apache本地服务器(localhost访问)步骤:

1、打开apache安装目录下的conf文件夹的httpd.conf文件,修改Listen 80为未被占用的端口号。

2、更改映射根目录,找到如下代码修改引号内容为自己指定的目录即可。

DocumentRoot "e:/webs"
<Directory "e:/webs">


配置apache本地虚拟服务器(域名访问,需配置虚拟服务器文件)步骤:

1、打开apache安装目录下的conf文件夹的httpd.conf文件,查找vhost找到“LoadModule vhost_alias_module modules/mod_vhost_alias.so”和“Include conf/extra/httpd-vhosts.conf”两句话,去掉前面的“#”号,使得apache加载vhost文件。

2、conf/extra/httpd-vhosts.conf,找到该文件,进行虚拟主机配置,在末尾处添加如下代码:

<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
        DocumentRoot "e:/webs/1116/shop"
        ServerName web.1116shop.com
        # DirectoryIndex index.html
        <Directory />
            Options Indexes FollowSymLinks
            AllowOverride ALL
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost>

*DocumentRoot即本地虚拟主机的根目录,ServerName为虚拟主机的域名(在浏览器键入该域名则会访问指定根目录)。

0 0
原创粉丝点击