国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > Apache > 正文

Apache服務器一個IP多個站點的配置方法示例

2024-08-27 18:22:56
字體:
來源:轉載
供稿:網友
這篇文章主要介紹了Apache服務器一個IP多個站點的配置方法示例,本文介紹的方法其實就是虛擬主機的方式,需要的朋友可以參考下

在日常的網站發布中很多情況下都無法做到一個IP對應一個站點,在IP4的情況下IP的資源是相對有限的。然而作為最流行的Apache自然也考慮到這種情況,那么接下來看看apache服務器怎么配置一個IP多個站點。

在httpd.conf中找到 "# Virtual hosts",并添加如下行
復制代碼 代碼如下:
ServerName 你的域名
HostNameLookups off

例子  

NameVirtualHost 192.168.1.104<VirtualHost 192.168.1.104>    ServerName www.php.com    ServerAdmin test@gmail.com    DocumentRoot /data/www1/    DirectoryIndex index.php index.html index.htm index.shtml    Errorlog /usr/local/apache2/logs/wwwError_log    Loglevel warn    HostNameLookups off    <Directory /data/www1/>     AllowOverride None     Order allow,deny     Allow from all    </Directory></VirtualHost><VirtualHost 192.168.1.104>    ServerName bbs.php.com    ServerAdmin test@gmail.com    DocumentRoot /data/www2/    DirectoryIndex index.php index.html index.htm index.shtml    Errorlog /usr/local/apache2/logs/bbsError_log    Loglevel warn    HostNameLookups off    <Directory /data/www2/>     AllowOverride None     Order allow,deny     Allow from all    </Directory></VirtualHost>

上述的例子IP都是192.168.1.104,域名分別是www.php.com和bbs.php.com。因而可知apahce是通過ServerName來識別同一個IP下的不同站點的。

  在實際應用中你只需要將IP192.168.1.104、域名www.php.com和bbs.php.com分別改成你的IP和域名即可。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 九龙县| 柯坪县| 瓦房店市| 芦溪县| 合肥市| 峨边| 繁昌县| 龙口市| 永川市| 马尔康县| 深泽县| 门源| 翼城县| 泗水县| 抚远县| 义乌市| 科技| 余庆县| 新密市| 南通市| 安塞县| 滕州市| 商南县| 广德县| 天柱县| 社会| 贵溪市| 翁源县| 眉山市| 西和县| 方山县| 葵青区| 太原市| 汽车| 仁化县| 满洲里市| 长兴县| 德江县| 陇西县| 安阳市| 台湾省|