NGINX-配置例子02

2017-07-10  本文已影响0人  落魄de少爷
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  0;

    gzip on;
    gzip_min_length 1k;
    gzip_buffers 16 64k;
    gzip_http_version 1.1;
    gzip_comp_level 6;
    gzip_types text/plain application/x-javascript text/css application/xml;
    gzip_vary on;

    server {
        listen       80;
        server_name  m.example.com;

        location / {
            root /home/mobile;
            try_files $uri $uri/ /index.html;
        }
    }

    server {
        listen       80;
        server_name  static.easybao.com;

        location / {
            rewrite ^(.*) https://s.example.com/$1 permanent;
        }
    }

    server {
        listen       80;
        server_name  www.example.com;

        location / {
            if ( $http_user_agent ~ "iPhone|Android" ) {
                 rewrite ^(.*) https://m.example.com permanent;
            }
            root /home/wwww;
            index index.html index.htm;
        }
    }
}
上一篇 下一篇

猜你喜欢

热点阅读