Apache 配置多端口网站
跳过安装步骤。
1. apache安装目录/conf/httpd.conf,如果你是采用wamp集成环境,那么在 wamp/bin/apache下。 2. 在httpd.conf中,找到 #LoadModule vhost_alias_module #Include conf/extra/httpd-vhosts.conf 去掉前面的#号,这一步是为了加载扩展配置 3. 找到apache安装目录/conf/extra/httpd-vhosts.conf。 打开文件找到 NameVirtualHost *:80, 比如我们要添加81的端口,在下面增加一行 Listen 81 4. 然后找到<VirtualHost *:80> ... </VirtualHost> ,复制一段修改为 <VirtualHost *:81> DocumentRoot "D:/php" ServerName localhost ServerAlias localhost </VirtualHost> 5. 配置目录权限 打开/conf/httpd.conf,找到Directory节点。 可以修改默认目录权限,也可以单独指定目录权限,分别是: 修改默认目录权限,即修改Directory节点 <Directory /> Options FollowSymLinks AllowOverride None Order deny,allow #Deny from all Allow from all #允许所有访问 Satisfy all </Directory> 或者增加如下一段 <Directory "D:/php"> # # 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.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride all # # Controls who can get stuff from this server. # # onlineoffline tag - don‘t remove Order Allow,Deny Allow from all </Directory>
6. 重启apache服务,查看localhost:81/index.php 已经可以正常运行了
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。