Apache 多端口多站點(diǎn)配置方法
更新時(shí)間:2010年08月01日 19:21:10 作者:
Apache多端口多站點(diǎn)的配置方法,配置apache服務(wù)器的朋友可以參考下。
配置httpd.conf
監(jiān)聽多個(gè)端口
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 8081
Listen 8082
Listen 8083
#增加監(jiān)聽端口
等以下內(nèi)容都設(shè)置以后,可以通過netstat -n -a查看端口是否開啟
開啟虛擬站點(diǎn)
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
#修改為
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
配置PHP模塊
加載php模塊,php5apache2_2代表使用的是apache2.2或以上版本
LoadModule php5_module "c:/php/php5apache2_2.dll"
PHPIniDir "C:/php"
配置php文件類型映射
AddType application/x-httpd-php .php
配置conf/extra/httpd-vhosts.conf
<VirtualHost *:8082>
ServerAdmin webmaster@dummy-host.localhost
DocumentRoot "C:/PhpDocRoot/Site1"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" common
<Directory "C:/PhpDocRoot/Site1">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:8083>
ServerAdmin webmaster@dummy-host2.localhost
DocumentRoot "C:/PhpDocRoot/Site2"
ServerName localhost
ErrorLog "logs/dummy-host2.localhost-error.log"
CustomLog "logs/dummy-host2.localhost-access.log" common
<Directory "C:/PhpDocRoot/Site2">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<Directory...>...</Directory>
一定不能少
重新啟動(dòng)apache試一下,如果出錯(cuò),查看一下logs下面的log文件還有windows的事件查看器記錄的錯(cuò)誤日志。
監(jiān)聽多個(gè)端口
復(fù)制代碼 代碼如下:
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 8081
Listen 8082
Listen 8083
#增加監(jiān)聽端口
等以下內(nèi)容都設(shè)置以后,可以通過netstat -n -a查看端口是否開啟
開啟虛擬站點(diǎn)
復(fù)制代碼 代碼如下:
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
#修改為
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
配置PHP模塊
加載php模塊,php5apache2_2代表使用的是apache2.2或以上版本
LoadModule php5_module "c:/php/php5apache2_2.dll"
PHPIniDir "C:/php"
配置php文件類型映射
AddType application/x-httpd-php .php
配置conf/extra/httpd-vhosts.conf
復(fù)制代碼 代碼如下:
<VirtualHost *:8082>
ServerAdmin webmaster@dummy-host.localhost
DocumentRoot "C:/PhpDocRoot/Site1"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" common
<Directory "C:/PhpDocRoot/Site1">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:8083>
ServerAdmin webmaster@dummy-host2.localhost
DocumentRoot "C:/PhpDocRoot/Site2"
ServerName localhost
ErrorLog "logs/dummy-host2.localhost-error.log"
CustomLog "logs/dummy-host2.localhost-access.log" common
<Directory "C:/PhpDocRoot/Site2">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<Directory...>...</Directory>
一定不能少
重新啟動(dòng)apache試一下,如果出錯(cuò),查看一下logs下面的log文件還有windows的事件查看器記錄的錯(cuò)誤日志。
相關(guān)文章
Linux統(tǒng)計(jì)某個(gè)字符串出現(xiàn)次數(shù)并排序的實(shí)現(xiàn)步驟
最近遇到一個(gè)流量異常調(diào)用的接口,所以需要通過后臺(tái)日志查看接口調(diào)用情況,先統(tǒng)計(jì)今天內(nèi)接口的調(diào)用次數(shù),再具體到對(duì)應(yīng)的設(shè)備號(hào),所以本文給大家介紹了Linux統(tǒng)計(jì)某個(gè)字符串出現(xiàn)次數(shù)并排序的實(shí)現(xiàn)步驟,需要的朋友可以參考下2024-07-07
Linux程序運(yùn)行找不到動(dòng)態(tài)庫(kù).so文件的解決
這篇文章主要介紹了Linux程序運(yùn)行找不到動(dòng)態(tài)庫(kù).so文件的解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-11-11
gdb調(diào)試中設(shè)置監(jiān)控點(diǎn)watch,rwatch,awatch的區(qū)別及說明
這篇文章主要介紹了gdb調(diào)試中設(shè)置監(jiān)控點(diǎn)watch,rwatch,awatch的區(qū)別及說明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-09-09
PHP腳本內(nèi)存泄露導(dǎo)致Apache頻繁宕機(jī)解決方法
這篇文章主要介紹了PHP腳本內(nèi)存泄露導(dǎo)致Apache頻繁宕機(jī)解決方法,本文的原因是因?yàn)镸axRequestsPerChild參數(shù)沒有配置正確,配置MaxRequestsPerChild后解決了本文中的問題,需要的朋友可以參考下2014-09-09
在linux系統(tǒng)下安裝兩個(gè)nginx的簡(jiǎn)單方法
下面小編就為大家?guī)?lái)一篇在linux系統(tǒng)下安裝兩個(gè)nginx的簡(jiǎn)單方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來(lái)看看吧2016-12-12
動(dòng)態(tài)在線擴(kuò)容root根分區(qū)大小的方法詳解
這篇文章主要給大家介紹了關(guān)于如何動(dòng)態(tài)在線擴(kuò)容root根分區(qū)大小的方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2018-05-05
解決:ping: www.baidu.com:未知的名稱或服務(wù)問題
文章描述了在CentOS 7中配置網(wǎng)絡(luò)后出現(xiàn)無(wú)法ping通域名的問題,并提供了解決步驟,首先檢查電腦的IP地址,確保與VMware網(wǎng)絡(luò)配置一致,然后編輯VMware的網(wǎng)絡(luò)配置,修改ifcfg-ens33文件(注意該文件是只讀的,需要按esc退出插入模式2024-12-12

