如何让Apache绑定多个域名
解决办法:
打开http . conf
1 ,ServerName 127.0 . 0.1 修改成ServerName 你的IP
2 , # NameVirtualHost * 修改成"NameVirtualHost 你的IP"
3 ,在文件最后面有虚拟主机格式,
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
< VirtualHost *: 80 >
ServerAdmin nettc@ 163 . com
DocumentRoot / usr / local / www / mpc /
ServerName scbn . nybd . cn
DirectoryIndex index . htm index . html index . php index . cgi index . pl
DefaultLanguage zh - CN
AddDefaultCharset GB2312
< Directory " /usr/local/www/mpc/ " >
Options FollowSymLinks
AllowOverride None
Order allow , deny
Allow from all
</ Directory >
< IfDefine PHP >
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir none
php_admin_value session . save_path " /usr/local/tmp/php/session "
php_admin_value open_basedir " /usr/local/www/mpc;/usr/local/tmp/php "
</ IfDefine >
</ VirtualHost >
< VirtualHost *: 80 >
ServerAdmin 139226688 @qq . com
DocumentRoot / usr / local / www / lovefan /
ServerName bbs . nybd . com
DirectoryIndex index . htm index . html index . php index . cgi index . pl
DefaultLanguage zh - CN
AddDefaultCharset GB2312
< Directory " /usr/local/www/lovefan/ " >
Options FollowSymLinks
AllowOverride None
Order allow , deny
Allow from all
</ Directory >
< IfDefine PHP >
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir none
php_admin_value session . save_path " /usr/local/tmp/php/session "
php_admin_value open_basedir " /usr/local/www/lovefan;/usr/local/tmp/php "
</ IfDefine >
</ VirtualHost >
< VirtualHost *: 80 >
ServerAdmin 139226688 @qq . com
DocumentRoot / usr / local / www / xiaoyao /
ServerName 51kiss . sy850 . com
DirectoryIndex index . htm index . html index . php index . cgi index . pl
DefaultLanguage zh - CN
AddDefaultCharset GB2312
< Directory " /usr/local/www/xiaoyao/ " >
Options FollowSymLinks
AllowOverride None
Order allow , deny
Allow from all
</ Directory >
< IfDefine PHP >
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir none
php_admin_value session . save_path " /usr/local/tmp/php/session "
php_admin_value open_basedir " /usr/local/www/xiaoyao;/usr/local/tmp/php "
</ IfDefine >
</ VirtualHost >
< VirtualHost *: 80 >
ServerAdmin 139226688 @qq . com
DocumentRoot / usr / local / www / duandong / bbs /
ServerName www . nybd . cn
DirectoryIndex index . htm index . html index . php index . cgi index . pl
DefaultLanguage zh - CN
AddDefaultCharset GB2312
< Directory " /usr/local/www/duandong/bbs/ " >
Options FollowSymLinks
AllowOverride None
Order allow , deny
Allow from all
</ Directory >
< IfDefine PHP >
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir none
php_admin_value session . save_path " /usr/local/tmp/php/session "
php_admin_value open_basedir " /usr/local/www/duandong/bbs;/usr/local/tmp/php "
</ IfDefine >
</ VirtualHost >
< VirtualHost *: 80 >
ServerAdmin shhczn@ 163 . com
DocumentRoot / usr / local / www / ddv /
ServerName hcwl . nybd . cn
DirectoryIndex index . htm index . html index . php index . cgi index . pl
DefaultLanguage zh - CN
AddDefaultCharset GB2312
< Directory " /usr/local/www/ddv/ " >
Options FollowSymLinks
AllowOverride None
Order allow , deny
Allow from all
</ Directory >
< IfDefine PHP >
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir none
php_admin_value session . save_path " /usr/local/tmp/php/session "
php_admin_value open_basedir " /usr/local/www/ddv;/usr/local/tmp/php "
</ IfDefine >
</ VirtualHost >
解决办法:
打开http . conf
1 ,ServerName 127.0 . 0.1 修改成ServerName 你的IP
2 , # NameVirtualHost * 修改成"NameVirtualHost 你的IP"
3 ,在文件最后面有虚拟主机格式,
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
< VirtualHost *: 80 >
ServerAdmin nettc@ 163 . com
DocumentRoot / usr / local / www / mpc /
ServerName scbn . nybd . cn
DirectoryIndex index . htm index . html index . php index . cgi index . pl
DefaultLanguage zh - CN
AddDefaultCharset GB2312
< Directory " /usr/local/www/mpc/ " >
Options FollowSymLinks
AllowOverride None
Order allow , deny
Allow from all
</ Directory >
< IfDefine PHP >
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir none
php_admin_value session . save_path " /usr/local/tmp/php/session "
php_admin_value open_basedir " /usr/local/www/mpc;/usr/local/tmp/php "
</ IfDefine >
</ VirtualHost >
< VirtualHost *: 80 >
ServerAdmin 139226688 @qq . com
DocumentRoot / usr / local / www / lovefan /
ServerName bbs . nybd . com
DirectoryIndex index . htm index . html index . php index . cgi index . pl
DefaultLanguage zh - CN
AddDefaultCharset GB2312
< Directory " /usr/local/www/lovefan/ " >
Options FollowSymLinks
AllowOverride None
Order allow , deny
Allow from all
</ Directory >
< IfDefine PHP >
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir none
php_admin_value session . save_path " /usr/local/tmp/php/session "
php_admin_value open_basedir " /usr/local/www/lovefan;/usr/local/tmp/php "
</ IfDefine >
</ VirtualHost >
< VirtualHost *: 80 >
ServerAdmin 139226688 @qq . com
DocumentRoot / usr / local / www / xiaoyao /
ServerName 51kiss . sy850 . com
DirectoryIndex index . htm index . html index . php index . cgi index . pl
DefaultLanguage zh - CN
AddDefaultCharset GB2312
< Directory " /usr/local/www/xiaoyao/ " >
Options FollowSymLinks
AllowOverride None
Order allow , deny
Allow from all
</ Directory >
< IfDefine PHP >
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir none
php_admin_value session . save_path " /usr/local/tmp/php/session "
php_admin_value open_basedir " /usr/local/www/xiaoyao;/usr/local/tmp/php "
</ IfDefine >
</ VirtualHost >
< VirtualHost *: 80 >
ServerAdmin 139226688 @qq . com
DocumentRoot / usr / local / www / duandong / bbs /
ServerName www . nybd . cn
DirectoryIndex index . htm index . html index . php index . cgi index . pl
DefaultLanguage zh - CN
AddDefaultCharset GB2312
< Directory " /usr/local/www/duandong/bbs/ " >
Options FollowSymLinks
AllowOverride None
Order allow , deny
Allow from all
</ Directory >
< IfDefine PHP >
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir none
php_admin_value session . save_path " /usr/local/tmp/php/session "
php_admin_value open_basedir " /usr/local/www/duandong/bbs;/usr/local/tmp/php "
</ IfDefine >
</ VirtualHost >
< VirtualHost *: 80 >
ServerAdmin shhczn@ 163 . com
DocumentRoot / usr / local / www / ddv /
ServerName hcwl . nybd . cn
DirectoryIndex index . htm index . html index . php index . cgi index . pl
DefaultLanguage zh - CN
AddDefaultCharset GB2312
< Directory " /usr/local/www/ddv/ " >
Options FollowSymLinks
AllowOverride None
Order allow , deny
Allow from all
</ Directory >
< IfDefine PHP >
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir none
php_admin_value session . save_path " /usr/local/tmp/php/session "
php_admin_value open_basedir " /usr/local/www/ddv;/usr/local/tmp/php "
</ IfDefine >
</ VirtualHost >