[Original]设置默认虚拟主机,防止非法域名绑定
有些站点,经常因为被别人绑定了未备案的域名,遭电信关闭IP。该规则,也经常被竞争对手恶意利用。因此,对Web Serve设置默认虚拟主机,来屏蔽非法域名很重要。
Nginx的做法
添加以下server zone
server {
listen 80 default;
return 500;
}
或者是将非法域名的访问重定向
有些站点,经常因为被别人绑定了未备案的域名,遭电信关闭IP。该规则,也经常被竞争对手恶意利用。因此,对Web Serve设置默认虚拟主机,来屏蔽非法域名很重要。
添加以下server zone
server {
listen 80 default;
return 500;
}
或者是将非法域名的访问重定向
1. WordPress Mu后台开启永久链接功能
后台-设置-永久链接-自定义结构-/blog/archives/%post_id%
2. 修改Nginx.conf,加入rewrite rules
location / {
index index.html index.htm index.php;
root /data0/data_www/hangyan.com/wp;
#on server block
##necessary if using a multi-site plugin
server_name_in_redirect off;
##necessary if running Nginx behind a reverse-proxy
port_in_redirect off;
rewrite ^.*/files/(.*) /wp-content/blogs.php?file=$1;
if (!-e $request_filename) {
rewrite ^.+?(/wp-.*) $1 last;
rewrite ^.+?(/.*\.php)$ $1 last;
rewrite ^ /index.php last;
}
}
故障现象
某Web服务器,突然出现以下问题,php-cgi僵死在进程里,无法重启
www 9463 0.0 0.3 41996 13612 ? D Apr19 1:22 /usr/local/php/bin/php-cgi –fpm
www 20858 0.0 0.3 40408 12932 ? D May05 1:55 /usr/local/php/bin/php-cgi –fpm
www 20866 0.0 0.3 40688 13296 ? D May05 1:53 /usr/local/php/bin/php-cgi –fpm
www 20878 0.0 0.3 40932 13604 ? D May05 1:51 /usr/local/php/bin/php-cgi –fpm
www 24288 0.0 0.3 40436 12880 ? D Apr15 2:36 /usr/local/php/bin/php-cgi –fpm
www 26881 0.0 0.3 41596 13712 ? D Apr16 6:11 /usr/local/php/bin/php-cgi –fpm
www 26921 0.0 0.3 43224 15848 ? D Apr16 5:57 /usr/local/php/bin/php-cgi –fpm
www 26983 0.0 0.3 42736 14524 ? D Apr16 6:01 /usr/local/php/bin/php-cgi –fpm
www 27007 0.0 0.3 42608 14248 ? D Apr16 6:01 /usr/local/php/bin/php-cgi –fpm
www 27023 0.0 0.3 42464 15172 ? D Apr16 5:57 /usr/local/php/bin/php-cgi –fpm
处理过程
# 查看默认的运行级别,Debian系默认运行级别为2,Redhat系默认运行级别为3
[11:34:29.9] root@webserver:/usr/local/webserver/nginx# runlevel
[11:34:31.8] N 2webserverwebserver
故障现象
访问页面出现(502)bad gateway,或者(403)Access Forbid错误.
部分错误日志
Apr 15 00:30:41 sqweb2 kernel: lockd: server 192.168.96.50 not responding, timed out
Apr 15 00:31:21 sqweb2 last message repeated 10 times
Apr 15 00:32:31 sqweb2 last message repeated 21 times
Apr 15 00:33:41 sqweb2 last message repeated 17 times
主交换 CPU在10%左右,MEM在20-30%之间波动
1.IIS7.5启用目录列表
常用于FTP站点,范例:http://ftp.99dev.net
Scenario: Let’s say I want to enable directory browsing for a special directory on my site, how do I enable that? It’s as easy as:
1) create (or edit) the web.config file in your site’s home directory
2) edit it as follows:
近期评论