[root@web01 /]# cat /app/server/nginx/conf/nginx.conf

 user  www www;
worker_processes ; error_log /app/log/nginx/error.log crit;
pid /app/server/nginx/logs/nginx.pid; #Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile ; events
{
use epoll;
worker_connections ;
} http {
include mime.types;
default_type application/octet-stream; #charset gb2312; server_names_hash_bucket_size ;
client_header_buffer_size 32k;
large_client_header_buffers 32k;
client_max_body_size 8m; sendfile on;
tcp_nopush on; keepalive_timeout ; tcp_nodelay on; fastcgi_connect_timeout ;
fastcgi_send_timeout ;
fastcgi_read_timeout ;
fastcgi_buffer_size 64k;
fastcgi_buffers 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k; gzip on;
gzip_min_length 1k;
gzip_buffers 16k;
gzip_http_version 1.0;
gzip_comp_level ;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
#limit_zone crawler $binary_remote_addr 10m;
log_format '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
include /app/server/nginx/conf/vhosts/*.conf;
}

nginx vhosts 配置文件独立文件存在

注意:添加第56行内容

 [root@web01 /]# cat /app/server/nginx/conf/vhosts/default.conf
server {
listen default_server;
server_name web01.espressos.cn;
root /app/www;
index index.php index.html index.htm;
location ^~ /images/ {
alias /var/tmp/images/;
valid_referers none blocked *.espressos.cn *.qq.com *.baidu.com;
if ($invalid_referer) {
rewrite ^/ http://192.168.1.25/404.jpg;
} }
location ~* \.(gif|jpg|png|swf|flv)$ {
expires 30d;
}
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
include fastcgi.conf;
}
access_log /app/log/nginx/access/default.log;
include /app/server/nginx/conf/rewrite/default.conf;#加上这句话
}
[root@web01 /]# file /app/server/nginx/conf/rewrite/default.conf
/app/server/nginx/conf/rewrite/default.conf: ASCII text

nginx vhosts rewrite 独立文件的方式出现的更多相关文章

  1. nginx负载均衡(5种方式)、rewrite重写规则及多server反代配置梳理

    Nginx除了可以用作web服务器外,他还可以用来做高性能的反向代理服务器,它能提供稳定高效的负载均衡解决方案.nginx可以用轮询.IP哈希.URL哈希等方式调度后端服务器,同时也能提供健康检查功能 ...

  2. (转)nginx负载均衡(5种方式)、rewrite重写规则及多server反代配置梳理

    Nginx除了可以用作web服务器外,他还可以用来做高性能的反向代理服务器,它能提供稳定高效的负载均衡解决方案.nginx可以用轮询.IP哈希.URL哈希等方式调度后端服务器,同时也能提供健康检查功能 ...

  3. 使用nginx的rewrite实现代理指定文件夹命令方法

    使用nginx的rewrite实现代理指定文件夹命令方法 使用nginx代理Tomcat,Tomcat公布web的时候通常都是带着项目名称的. 比方项目名称为"aven".那么公布 ...

  4. Nginx的Rewrite规则与实例

    通过Rewrite规则可以实现规范的URL.根据变量来做URL转向及选择配置,用好Rewrite有时起到事半功倍的效果. 语法 Nginx的Rewrite相比Apache的要好理解很多,主要使用指令有 ...

  5. nginx之rewrite相关功能

    Nginx Rewrite相关功能 Nginx服务器利用ngx_http_rewrite_module 模块解析和处理rewrite请求,此功能依靠 PCRE(perl compatible regu ...

  6. nginx 缓存,大文件分片请求方法

    实现的途径:expire cache-control 更新缓存的机制 如何校验本地缓存是否过期 expires cache-control(max-age)如果超期,说明失效 然后进行etag是否过期 ...

  7. Nginx 实现 Rewrite 跳转

    文章原创于公众号:程序猿周先森.本平台不定时更新,喜欢我的文章,欢迎关注我的微信公众号. 上一篇文章对Nginx的Location配置进行了讲解,本篇主要对于Nginx中的Rewrite跳转进行讲解. ...

  8. Nginx实现rewrite重写

    目录 Rewrite基本概述 Rewrite标记Flag Rewrite规则实践 Rewrite场景示例 Rewrite规则补充 rewrite优先级实战 Rewrite基本概述 什么是rewrite ...

  9. nginx 配置rewrite 笔记

    nginx 配置rewrite笔记: 通过下面的示例来说明一下,1. 先说说location : location 表示匹配传入的url地址,其中配置符有多种,各种情况的意义不一样: location ...

随机推荐

  1. [转] SQL Server 批量 停用/启用 外键约束

    本文转自:http://hi.baidu.com/wangzhiqing999/item/ca699308de4f1ff9a1103429 今天百度知道上面,看到这样一个要求: 现在有一个库,有很多张 ...

  2. 【转载】WebStorm安装 & Nodejs-Express Demo

    试试下面这个方法: http://www.sdifenzhou.com/?p=6941 从这里下载 http://pan.baidu.com/share/link?shareid=2512210975 ...

  3. c++ opencv3.4 保存和读取PCA模型

    cv::PCA pca(samples, cv::Mat(), cv::PCA::DATA_AS_ROW,); FileStorage fs("pca.xml",FileStora ...

  4. scrapy-splash抓取动态数据例子四

    一.介绍 本例子用scrapy-splash抓取微众圈网站给定关键字抓取咨询信息. 给定关键字:打通:融合:电视 抓取信息内如下: 1.资讯标题 2.资讯链接 3.资讯时间 4.资讯来源 二.网站信息 ...

  5. log4j实现每一个线程保存一个日志文件

    log4j.properties: ### direct log messages to stdout ### log4j.appender.stdout=org.apache.log4j.Conso ...

  6. 电子商务ICP经营许可证申请条件

    电子商务ICP经营许可证申请条件:注册资金100万的纯内资公司:服务器在本地:域名备案以公司名义备案:申请条件:1.公司营业执照副本复印件需清晰有效,并已完成该年度年检事宜,特别注意营业执照的有效期要 ...

  7. java二维码小试牛刀

    旁白: 由于工作需要,要做一个java的二维码的图片,花了2天的时间学习了一下,过程中也遇到了一些问题,这里做个笔记,收藏了. 废话不多说了,入题吧! 转自:http://www.open-open. ...

  8. HDU 5296 Annoying problem

    Annoying problem Time Limit: 16000/8000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others ...

  9. 算法笔记_101:蓝桥杯练习 算法提高 身份证号码升级(Java)

    目录 1 问题描述 2 解决方案   1 问题描述 问题描述 从1999年10月1日开始,公民身份证号码由15位数字增至18位.(18位身份证号码简介).升级方法为: 1.把15位身份证号码中的年份由 ...

  10. windwos at 以及shutdown使用方法

    at 12:00 shutdown -r如果今天12点没过去,今天12点重启,如果今天12点已经过去,明天12点重启.每天12点重启的命令是at 12:00 /every:Monday,Tuesday ...