三步搞定vhost域名配置

    技术2022-05-19  21

    第一步找到httpd.conf

     

    # Virtual hosts

    #Include conf/extra/httpd-vhosts.conf

    改成

     

    # Virtual hosts

    Include conf/extra/httpd-vhosts.conf

    第二步找到

    DocumentRoot "e:/AppServ/www"

    改成

    #DocumentRoot "e:/AppServ/www"

    第三步找到 httpd-vhosts.conf文件

    添加

    <VirtualHost *:80>

        ServerAdmin tengzhaorong@gmail.com

        DocumentRoot E:/AppServ/www/

        ServerName localhost

        ErrorLog logs/localhost.com-error_log

        CustomLog logs/localhost.com-access_log common

    </VirtualHost>

    这段保证localhost能访问

    <VirtualHost *:80>

        ServerAdmin tengzhaorong@gmail.com

        DocumentRoot E:/AppServ/www/survey/

        ServerName www.survey.com

        ErrorLog logs/survey.com-error_log

        CustomLog logs/survey.com-access_log common

    </VirtualHost>

    本地设置的虚拟域名

    第四步,域名映射

    在文件C:/WINDOWS/system32/drivers/etc

    Hosts文件添加127.0.0.1       www.survey.com

     

    若访问时403禁止访问,则把

    <Directory />

        Options FollowSymLinks ExecCGI Indexes

        AllowOverride None

        Order deny,allow

        Deny from all

        Satisfy all

    </Directory>

    中的Deny from all

    改为Allow from all


    最新回复(0)