Apache下同一个IP配置多个虚拟主机

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Apache下同一个IP配置多个虚拟主机


NameVirtualHost192.100.100.1


ServerAdminnjzadmin@
DocumentRoot/wwwroot

ErrorLoglogs/-error_log
Customloglogs/a-Access_logcommon



ServerAdminsonymusic@
DocumentRoot/wwwroot2

ErrorLoglogs/-error_log
CustomLoglogs/-access_logcommon



Apache配置httpd.conf设置一个IP两个域名的方法 如何让两个域名对应同一个IP,然后能识别出不同的网站

本身Virtual Hosting技术分IP-based和Host-based。IP-based Virtual Hosting是指运行网站服务器的计算机有多个 IP地址(IP Address),访问不同的IP地址就可以取得不同的网站。Host-based Virtual Hosting则是指在DNS上多个网域 都是指向同一个IP地址,网页浏览器(WWW Browser)透过HTTP协定告知网页服务器要访问那个网站。


一个IP地址,多域名配置:

Listen 80

NameVirtualHost 61.139.72.10



DocumentRoot /var/www/html/

ServerName





DocumentRoot /var/www/html/

CustomLog /var/www/html/logs/home-access_log common

ServerName



多IP多域名配置:



DocumentRoot "/usr/local/apache/a"

ServerName

ServerAlias

DirectoryIndex index.html index.php



NameVirtualHost 192.168.1.2:80



DocumentRoot "/usr/local/apache/b"

ServerName

ServerAlias

DirectoryIndex index.php





DocumentRoot "/usr/local/apache/c"

ServerName

ServerAlias

DirectoryIndex index.php



------------------------------------------------------------------------------------------


# 在ServerName后加上你的网站名称 ServerName # 如果你想多个网站名称都取得相同的网站,可以加在ServerAlias后加上其他网站别名。 # 别名间以空格间开。 ServerAlias # 在ServerAdmin后加上网站管理员的电邮地址,方便别人有问题是可以联络网站管理员。 ServerAdmin webmaster@ # 在DocumentRoot后加上存放网站内容的目录路径 DocumentRoot /var/www/ Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ AllowOverride None Options ExecCGI -MultiViews +SymLinksIfOwnerMatch Allow from all ErrorLog /var/log/httpd/error.log # Possible values i

nclude: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/httpd/access.log combined ServerSignature On官方给的例子:/docs/2.2/vhosts/examples.html

相关文档
最新文档