[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. spring的@Async异步使用

    pring的@Async功能,用的时候一定要注意: 1.异步方法和调用类不要在同一个类中. 2.xml里需要加入这一行 <task:annotation-driven/> 下面的可以直接粘 ...

  2. NAT和SNAT

    在Kubernetes负载均衡的方案中遇到了SNAT的问题,查资料把SNAT和NAT的大意了解一下 详细信息可以直接访问 https://support.f5.com/kb/en-us/product ...

  3. #!/usr/bin/env在脚本中的作用

    在linux的一些脚本,需在开头一行指定脚本的解释程序,如: #!/usr/bin/env bash #!/usr/bin/bash #!/usr/bin/env python  告诉操作系统执行这个 ...

  4. iOS:基于Socket的第三方框架CocoaAsyncSocket的使用

    CocoaAsyncSocket无疑是目前封装得最完善的Socket库了:支持异步TCP/UDP,支持GCD,Objective-C接口封装,同时还有日志跟踪功能,使用此日志跟踪,程序员可以很方便的进 ...

  5. Bayesian statistics

    文件夹 1Bayesian model selection贝叶斯模型选择 1奥卡姆剃刀Occams razor原理 2Computing the marginal likelihood evidenc ...

  6. 隐藏系统EFI分区Z盘

    找到C:\Windows\System32\cmd.exe程序, 右键单击cmd 选择以管理员身份运行, 打开命令提示符,输入以下命令(不区分大小写)DiskPart回车List空格volume回车s ...

  7. swift基础语法之控件使用02

    //第一个控制器:显示基础控件 import UIKit class ViewController: UIViewController { var label: UILabel = UILabel() ...

  8. 云计算之路-试用Azure:每一次删除都让人如此“心惊”

    这篇博文吐槽的是Azure(Virtual Machine)的虚拟机删除功能. 在阿里云中,没有提供直接的虚拟机删除操作,如果不用某台虚拟机,“停止”即可,过期一段时间后会自动释放(这里的释放相当于删 ...

  9. Android异步载入全解析之大图处理

    Android异步载入全解析之大图处理 异步载入中很重要的一部分就是对图像的处理,这也是我们前面用异步载入图像做示例的原因. 一方面是由于图像处理不好的话会很占内存,并且easyOOM,还有一方面,图 ...

  10. docker中的link

    一.查看容器的详细情形 docker inspect 容器id/名称 二.为什么要用link 容器每次重启时,ip都会变动,这不利于前端引用中连接数据库. 三.link docker run -p 8 ...