Posts Tagged ‘nginx’

Nginx apache集群 index无效问题

Saturday, December 4th, 2010

nginx apache集群后在nginx.conf 文件里这样设置

server {

Read More: 281 Words Totally

nginx 集群报"upstream" directive is not allowed here 错

Saturday, December 4th, 2010

搭建了一个服务器, 采用的是nginx + apache(多个) + php + mysql(两个) 多个apache负载均衡及后端mysql读写分离的服务器.  

当然如果网站流量小的话 就完全没有必要了! 一是搭建起来麻烦,二也增加了维护成本! 当你网站流量达到一定级别不考虑也得考虑了.

当设定好 upstream 如下:

Read More: 713 Words Totally

NginxChsHttpAccessModule

Sunday, January 3rd, 2010

ngx_http_access_module

此模块提供了一个简易的基于主机的访问控制.

ngx_http_access_module 模块使有可能对特定IP客户端进行控制. 规则检查按照第一次匹配的顺序

Read More: 242 Words Totally

检测 nginx 配置是否正确

Friday, January 1st, 2010

一、nginx的几个命令参数

Nginx 安装后只有一个程序文件,本身并不提供各种管理程序,它是使用参数和系统信号机制对 Nginx 进程本身进行控制的。 Nginx 的参数包括有如下几个:

可以这样使用 /usr/local/nginx/sbin/nginx  -参数

Read More: 542 Words Totally

nginx 图片防盗链

Wednesday, December 30th, 2009

试过了,如果将盗链图片替换为图片貌似不行,就返回一个404 或403吧.

location ~* \.(gif|jpg|png|bmp|swf|flv)$ { valid_referers none blocked *.jiucool.com *.google.com *.xiaoguo.com *.zhuaxia.com; if ($invalid_referer) {             return 403;         } }

Nginx WP Super Cache 配置规则

Friday, December 25th, 2009

location /blog/{                 autoindex off;                 set $wp_super_cache_file ”;                 set $wp_super_cache_uri $request_uri;                 if ( $request_method = POST )                 {                         set $wp_super_cache_uri ”;                 }                 if ( $query_string )                 {                         set $wp_super_cache_uri ”;                 }                 if ( $http_cookie ~* "comment_author_|wordpress|wp-postpass_" )                 {                         set $wp_super_cache_uri ”;                 }                 if ( $wp_super_cache_uri ~ ^(.+)$ )                 {                         set $wp_super_cache_file /blog/wp/wp-content/cache/wp_super_cache/$http_host/$1index.html;                 }                 if ( -f $document_root$wp_super_cache_file )                 {                         rewrite ^(.*)$ $wp_super_cache_file break;                 }                 if (-f $request_filename)                 {                         expires 30d;                         break;                 }                 if (!-e $request_filename)                 {                         rewrite ^(.+)$ /blog/index.php?q=$1 last;                 }         }    

nginx 301 永久重定向

Friday, December 25th, 2009

单独建一个server

server { server_name www.jiucool.com; rewrite ^(.*) http://jiucool.com$1 permanent; }

或者

Read More: 206 Words Totally