1、单域名单端口设置 如:www.abc.com 默认用80访问 特别说明,apache的配置默认都在安装目录下的conf目录里面 或者是/etc/apache2 不过一定要注意,listen.conf文件中端口监听是否开启 如下图,表示已经开启80端口监听

# Configure the DocumentRoot
#
# 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 None
# 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 None
# Controls who can get stuff from this server.
Order allow,deny
Allow from all
Options None
AllowOverride None
Order allow,deny
Allow from all
Options None
AllowOverride None
Order allow,deny
Allow from all
NameVirtualHost *:81
DirectoryIndex index.html index.PHP
ServerName "www.abc.com"
DocumentRoot "/srv/www/htdocs/"
DirectoryIndex index.php
ServerName "www.abc.com:81"
DocumentRoot "/srv/www/htdocs/bbs/"
3、多域名多端口设置
Options None
AllowOverride None
Order allow,deny
Allow from all