wampserver配置端口、虚拟主机;访问内网网站

2025-10-27 22:13:37

1、修改端口:

     找到httpd.conf文件,搜索80端口,把80替换为你需要的端口8080(是80的都改)

2、配置VirtualHost虚拟主机 :

    1、 找到apache的httpd.conf文件 注释掉下面代码,这些是wamp自己搭建的站点

 

#DocumentRoot "${INSTALL_DIR}/www"

#<Directory "${INSTALL_DIR}/www/">

    #

    # 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>

   2、找到httpd-vhosts.conf文件,修改端口、域名、网站指向的地址,如下

<VirtualHost *:8080>

  ServerName admin.wz.com

  ServerAlias admin.wz.com

  DocumentRoot "${INSTALL_DIR}/www/wz"

  <Directory "${INSTALL_DIR}/www/wz/">

    Options +Indexes +Includes +FollowSymLinks +MultiViews

    AllowOverride All

    Require local

  </Directory>

</VirtualHost>

   3、修改host文件:127.0.0.1 admin.wz.com

   4、访问:admin.wz.com:8080 记得带上端口

3、如果是部署到服务器,其他机子需要访问在上面1到2步骤后还需要修改两个地方,不然ping通了主机,也访问不了网站

     1、修改httpd.conf,如下

 

<Directory /> 

    Options FollowSymLinks

    AllowOverride None

    Order deny,allow

    Allow from all

</Directory>

     2、修改httpd-vhosts.conf,如下

 <Directory "${INSTALL_DIR}/www/wz/"> 

    Options +Indexes +Includes +FollowSymLinks +MultiViews

    AllowOverride All 

    Order deny,allow

    Allow from all

  </Directory>

 

 

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢