美文网首页
wamp设置多域名访问

wamp设置多域名访问

作者: 进击的大东 | 来源:发表于2019-04-25 11:15 被阅读0次

    wamp配置与使用

    • 下载安装

    • 默认访问路径在安装目录下的www文件夹下

    • 找到apach下的http.conf文件在里边添加新的访问根目录

      //搜DocumentRoot
      DocumentRoot "e:/myweb"
      <Directory "e:/myweb">
          #
          # Possible values for the Options directive are "None", "All",
          # or any combination of:
          #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
          #
          # Note that "MultiViews" must be named *explicitly* --- "Options All"
          # doesn't give it to you.
          #
          # The Options directive is both complicated and important.  Please see
          # http://httpd.apache.org/docs/2.4/mod/core.html#options
          # for more information.
          #
          Options +Indexes +FollowSymLinks +Multiviews
      
          #
          # AllowOverride controls what directives may be placed in .htaccess files.
          # It can be "All", "None", or any combination of the keywords:
          #   AllowOverride FileInfo AuthConfig Limit
          #
          AllowOverride all
      
          #
          # Controls who can get stuff from this server.
          #
      
      #   onlineoffline tag - don't remove
          Require local
      </Directory>
      
    • 搜Virtual hosts找到虚拟host配置文件Include conf/extra/httpd-vhosts.conf

    • 在配置文件中添加新域名

      <VirtualHost *:80>
        ServerName localhost
        ServerAlias localhost
        DocumentRoot E:/wamp/www
        <Directory  "E:/wamp/www/">
            Options +Indexes +Includes +FollowSymLinks +MultiViews
            AllowOverride All
            Require local
        </Directory>
      </VirtualHost>
      #
      <VirtualHost *:80>
        ServerName dadong
        ServerAlias dadong
        DocumentRoot E:/myweb/ajax
        <Directory  "E:/myweb/ajax">
            Options +Indexes +Includes +FollowSymLinks +MultiViews
            AllowOverride All
            Require local
        </Directory>
      </VirtualHost>
      
      <VirtualHost *:80>
        ServerName tom.com
        ServerAlias www.tom.com
        DocumentRoot E:/myweb/tom
        <Directory  "E:/myweb/tom">
            Options +Indexes +Includes +FollowSymLinks +MultiViews
            AllowOverride All
            Require local
        </Directory>
      </VirtualHost>
      
    • 最后一步需要在window/system32/drivers/etc/hosts文件中添加127.0.0.1 tom.com新配置的域名,这样你就可以使用不同域名访问不同目录下的项目啦

    相关文章

      网友评论

          本文标题:wamp设置多域名访问

          本文链接:https://www.haomeiwen.com/subject/mcuagqtx.html