- 论坛徽章:
- 0
|
本帖最后由 244159303 于 2012-03-14 11:16 编辑
原来用单线时ip:66.145.126.12,apache2里sites-enabled/000-default 是这样配置的,重启后没问题。
NameVirtualHost 66.145.126.12
<VirtualHost 66.145.126.12>
Servername 66.145.126.12
<Location />
Order Allow,Deny
Deny from all
</Location>
</VirtualHost>
<VirtualHost 66.145.126.12>
ServerName www.yyyy.com
ServerAdmin webmaster@localhost
#DocumentRoot /var/www/BackUp/WFBackup/var/www/www/
DocumentRoot /var/www/www/
#<FilesMatch "\.(mp3|rmvb|flv|mpg|wmv)">
<FilesMatch "\.(txt|svn|doc|mp3|rar|zip|rmvb|flv|mpg|wmv)">
Order Deny,Allow
Deny from all
</FilesMatch>
SetEnvIfNoCase Referer "^http://www.yyyy.com/" local_ref=1
SetEnvIfNoCase Referer "^http://www.yyyy.cn/" local_ref=1
<filesmatch "\.(pdf)">
Order Allow,Deny
Allow from env=local_ref
</filesmatch>
#<Location />
# Order Allow,Deny
# Deny from all
#</Location>
<Directory />
Options FollowSymLinks
AllowOverride All
#AllowOverride None
</Directory>
<Directory /var/www/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Deny,Allow
#Order allow,deny
Deny from 219.226.91.82
#allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
ErrorDocument 404 http://www.yyyy.com
ErrorDocument 403 http://www.yyyy.com
</VirtualHost>
改成双线后,ip变成二个,电信:183.63.19.16;联通:58.249.60.66,我在apache2配置文件sites-enabled/000-default里都改成localhost,重启后报错。
改成localhost后如下:
NameVirtualHost localhost
<VirtualHost localhost>
Servername localhost
<Location />
Order Allow,Deny
Deny from all
</Location>
</VirtualHost>
<VirtualHost localhost>
ServerName www.yyyy.com
ServerAdmin webmaster@localhost
#DocumentRoot /var/www/BackUp/WFBackup/var/www/www/
DocumentRoot /var/www/www/
#<FilesMatch "\.(mp3|rmvb|flv|mpg|wmv)">
<FilesMatch "\.(txt|svn|doc|mp3|rar|zip|rmvb|flv|mpg|wmv)">
Order Deny,Allow
Deny from all
</FilesMatch>
SetEnvIfNoCase Referer "^http://www.yyyy.com/" local_ref=1
SetEnvIfNoCase Referer "^http://www.yyyy.cn/" local_ref=1
<filesmatch "\.(pdf)">
Order Allow,Deny
Allow from env=local_ref
</filesmatch>
#<Location />
# Order Allow,Deny
# Deny from all
#</Location>
<Directory />
Options FollowSymLinks
AllowOverride All
#AllowOverride None
</Directory>
<Directory /var/www/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Deny,Allow
#Order allow,deny
Deny from 219.226.91.82
#allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
ErrorDocument 404 http://www.yyyy.com
ErrorDocument 403 http://www.yyyy.com
</VirtualHost>
重启后报错:root@freedom:/etc/apache2/sites-available# /etc/init.d/apache2 start
* Starting web server apache2
[Wed Mar 14 10:36:03 2012] [warn] VirtualHost 66.145.126.12:0 overlaps with VirtualHost 66.145.126.12:0, the first has precedence, perhaps you need a NameVirtualHost directive
[Wed Mar 14 10:36:03 2012] [warn] VirtualHost 66.145.126.12:0 overlaps with VirtualHost 66.145.126.12:0, the first has precedence, perhaps you need a NameVirtualHost directive
[Wed Mar 14 10:36:03 2012] [warn] VirtualHost 66.145.126.12:0 overlaps with VirtualHost 66.145.126.12:0, the first has precedence, perhaps you need a NameVirtualHost directive
[Wed Mar 14 10:36:03 2012] [warn] VirtualHost 66.145.126.12:0 overlaps with VirtualHost 66.145.126.12:0, the first has precedence, perhaps you need a NameVirtualHost directive
[Wed Mar 14 10:36:03 2012] [warn] NameVirtualHost localhost:0 has no VirtualHosts
...done. |
|