worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 0;
client_max_body_size 5m;
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;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
}
server {
listen 80;
server_name oss.example.com;
location / {
proxy_pass http://127.0.0.1:9999;
}
}
server {
listen 80;
server_name www.example.com;
location / {
root /home/wwww;
index index.html index.htm;
try_files $uri $uri/ /index.html;
if ( $http_user_agent ~ "iPhone|Android" ) {
rewrite ^(.*) http://m.example.com permanent;
}
}
location /api {
proxy_pass http://127.0.0.1:9999;
}
location /static {
proxy_pass http://127.0.0.1:9999;
}
}
server {
listen 80;
server_name example.com;
rewrite ^(.*) https://www.example.com permanent;
}
}
NGINX-配置例子03
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- [TOC] ** 以下所有的测试都是在CentOS6系统上进行的 ** ** 另外,本篇文章只配置最基本的配置项。...