apache配置多域名多端口
1、單域名單端口設置如:www.abc.com 默認用80訪問 特別說明,apache的配置默認都在安裝目錄下的conf目錄里面或者是/etc/apache2 不過一定要注意,listen.conf文件中端口監聽是否開啟如下圖,表示已經開啟80端口監聽 直接默認修改default-server.conf 這個配置最好簡單安裝好了,之后,默認已經能夠使用了,只是要把它修改成你需要的域名及訪問路徑罷了。 給一個標準配置吧 DocumentRoot "/srv/www/htdocs" #
# Configure the DocumentRoot
#
<Directory "/srv/www/htdocs">
# 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
</Directory> 2、單域名多端口設置 <Directory "/srv/www/htdocs/bbs">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/srv/www/htdocs/">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory> NameVirtualHost *:80
NameVirtualHost *:81
<VirtualHost *:80>
DirectoryIndex index.html index.php
ServerName "www.abc.com"
DocumentRoot "/srv/www/htdocs/"
</VirtualHost> <VirtualHost *:81>
DirectoryIndex index.php
ServerName "www.abc.com:81"
DocumentRoot "/srv/www/htdocs/bbs/"
</VirtualHost>
3、多域名多端口設置 <Directory "/srv/www/htdocs/btc">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory> <Directory "/srv/www/htdocs/bbs">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/srv/www/htdocs/">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory> NameVirtualHost *:80
NameVirtualHost *:81
<VirtualHost *:80>
DirectoryIndex index.html index.php
ServerName "www.abc.com"
DocumentRoot "/srv/www/htdocs/"
</VirtualHost> <VirtualHost *:80>
DirectoryIndex index.html index.php
ServerName "www.btc.com"
DocumentRoot "/srv/www/htdocs/btc"
</VirtualHost> <VirtualHost *:81>
DirectoryIndex index.php
ServerName "www.abc.com:81"
DocumentRoot "/srv/www/htdocs/bbs/"
</VirtualHost> 需要注意的問題是,多端口監聽,一定要注意listen.conf文件,是否開啟了相應端口。
關鍵字:apache 配置 域名 端口
新文章:
- CentOS7下圖形配置網絡的方法
- CentOS 7如何添加刪除用戶
- 如何解決centos7雙系統后丟失windows啟動項
- CentOS單網卡如何批量添加不同IP段
- CentOS下iconv命令的介紹
- Centos7 SSH密鑰登陸及密碼密鑰雙重驗證詳解
- CentOS 7.1添加刪除用戶的方法
- CentOS查找/掃描局域網打印機IP講解
- CentOS7使用hostapd實現無AP模式的詳解
- su命令不能切換root的解決方法
- 解決VMware下CentOS7網絡重啟出錯
- 解決Centos7雙系統后丟失windows啟動項
- CentOS下如何避免文件覆蓋
- CentOS7和CentOS6系統有什么不同呢
- Centos 6.6默認iptable規則詳解