Apache下同一个IP配置多个虚拟主机
Apache下同一个IP配置多个虚拟主机
NameVirtualHost192.100.100.1
ServerAdminnjzadmin@https://www.360docs.net/doc/cd7268644.html,
DocumentRoot/wwwroot
https://www.360docs.net/doc/cd7268644.html,
ErrorLoglogs/https://www.360docs.net/doc/cd7268644.html,-error_log
Customloglogs/a-Access_logcommon
ServerAdminsonymusic@https://www.360docs.net/doc/cd7268644.html,
DocumentRoot/wwwroot2
https://www.360docs.net/doc/cd7268644.html,
ErrorLoglogs/https://www.360docs.net/doc/cd7268644.html,-error_log
CustomLoglogs/https://www.360docs.net/doc/cd7268644.html,-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/https://www.360docs.net/doc/cd7268644.html,
ServerName https://www.360docs.net/doc/cd7268644.html,
DocumentRoot /var/www/html/https://www.360docs.net/doc/cd7268644.html,
CustomLog /var/www/html/logs/home-access_log common
ServerName https://www.360docs.net/doc/cd7268644.html,
多IP多域名配置:
DocumentRoot "/usr/local/apache/a"
ServerName https://www.360docs.net/doc/cd7268644.html,
ServerAlias https://www.360docs.net/doc/cd7268644.html,
DirectoryIndex index.html index.php
NameVirtualHost 192.168.1.2:80
DocumentRoot "/usr/local/apache/b"
ServerName https://www.360docs.net/doc/cd7268644.html,
ServerAlias https://www.360docs.net/doc/cd7268644.html,
DirectoryIndex index.php
DocumentRoot "/usr/local/apache/c"
ServerName https://www.360docs.net/doc/cd7268644.html,
ServerAlias https://www.360docs.net/doc/cd7268644.html,
DirectoryIndex index.php
------------------------------------------------------------------------------------------
nclude: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/httpd/access.log combined ServerSignature On官方给的例子:https://www.360docs.net/doc/cd7268644.html,/docs/2.2/vhosts/examples.html