apache虚拟机的配置

我的Apache安装在/usr/local/apache2

1、检测apache的配置文件是否有误:

     /usr/local/apache2/bin/apachetcl -t

2、vim /usr/local/apache2/conf/extra/http-vhosts.conf

  看到VirtualHost example的字样

 

复制

<VirtualHost *:80>
                   ......
                   ......
</VirtualHost>

至/usr/local/apache2/conf/httpd.conf中,且要在配置之前加一行NameVirtualHost *:80,最终效果如下

NameVirtualHost *:80
<VirtualHost *:80>
    DocumentRoot "/tmp/123"
    ServerName 123.com
</VirtualHost>

3、找到

<Directory />
    Options FollowSymLinks
    Allow Override None
    Order deny,allow
    Deny from all
</Directory>
改为
<Directory />
    Options FollowSymLinks
    Allow Override None
    Order deny,allow
    Allow from all
</Directory>

4、重复步骤1

5、重启Apache服务:/usr/local/apache2/bin/apachetcl

6、用curl进行测试

    makedir /tmp/123

    vim /tmp/123/1.txt

      curl localhost/1.txt

如果有问题,根据问题的提示进行解决

posted @ 2015-09-10 22:01  勤&惰  阅读(204)  评论(0编辑  收藏  举报