• nginx vhosts rewrite 独立文件的方式出现


     1 [root@web01 /]# cat /app/server/nginx/conf/nginx.conf
     2 
     3 user  www www;
     4 worker_processes  4;
     5 
     6 error_log  /app/log/nginx/error.log crit;
     7 pid        /app/server/nginx/logs/nginx.pid;
     8 
     9 #Specifies the value for maximum file descriptors that can be opened by this process. 
    10 worker_rlimit_nofile 65535;
    11 
    12 events 
    13 {
    14   use epoll;
    15   worker_connections 65535;
    16 }
    17 
    18 
    19 http {
    20     include       mime.types;
    21     default_type  application/octet-stream;
    22 
    23     #charset  gb2312;
    24 
    25     server_names_hash_bucket_size 128;
    26     client_header_buffer_size 32k;
    27     large_client_header_buffers 4 32k;
    28     client_max_body_size 8m;
    29 
    30     sendfile on;
    31     tcp_nopush     on;
    32 
    33     keepalive_timeout 60;
    34 
    35     tcp_nodelay on;
    36 
    37     fastcgi_connect_timeout 300;
    38     fastcgi_send_timeout 300;
    39     fastcgi_read_timeout 300;
    40     fastcgi_buffer_size 64k;
    41     fastcgi_buffers 4 64k;
    42     fastcgi_busy_buffers_size 128k;
    43     fastcgi_temp_file_write_size 128k;
    44 
    45     gzip on;
    46     gzip_min_length  1k;
    47     gzip_buffers     4 16k;
    48     gzip_http_version 1.0;
    49     gzip_comp_level 2;
    50     gzip_types       text/plain application/x-javascript text/css application/xml;
    51     gzip_vary on;
    52     #limit_zone  crawler  $binary_remote_addr  10m;
    53     log_format '$remote_addr - $remote_user [$time_local] "$request" '
    54                   '$status $body_bytes_sent "$http_referer" '
    55                   '"$http_user_agent" "$http_x_forwarded_for"';
    56     include /app/server/nginx/conf/vhosts/*.conf;
    57 }
    nginx vhosts 配置文件独立文件存在

     注意:添加第56行内容

     1 [root@web01 /]# cat /app/server/nginx/conf/vhosts/default.conf
     2 server {
     3     listen 80 default_server;
     4     server_name web01.espressos.cn;
     5     root /app/www;
     6     index index.php index.html index.htm;
     7     location ^~ /images/ {
     8     alias /var/tmp/images/;
     9     valid_referers none blocked *.espressos.cn *.qq.com *.baidu.com;
    10     if ($invalid_referer) {
    11     rewrite ^/ http://192.168.1.25/404.jpg;
    12     }    
    13 
    14     }
    15     location ~* .(gif|jpg|png|swf|flv)$ {
    16         expires 30d;
    17     }
    18     location ~ .*.(php|php5)?$
    19     {
    20        #fastcgi_pass  unix:/tmp/php-cgi.sock;
    21         fastcgi_pass  127.0.0.1:9000;
    22     fastcgi_index index.php;
    23     include fastcgi.conf;
    24     }
    25     access_log  /app/log/nginx/access/default.log;
    26     include /app/server/nginx/conf/rewrite/default.conf;#加上这句话
    27 }
    [root@web01 /]# file /app/server/nginx/conf/rewrite/default.conf 
    /app/server/nginx/conf/rewrite/default.conf: ASCII text
  • 相关阅读:
    C++ Primer Plus(三)
    C++ Primer Plus(二)
    C++ Primer Plus(一)
    C Primer Plus(三)
    C++ 函数重载,函数模板和函数模板重载,选择哪一个?
    Spring IoC 公共注解详解
    Spring IoC @Autowired 注解详解
    Spring IoC 容器的扩展
    Spring IoC bean 的初始化
    Spring IoC 属性赋值阶段
  • 原文地址:https://www.cnblogs.com/bass6/p/5752216.html
Copyright © 2020-2023  润新知