手机的配置
server {
listen 80;
server_name m.in83.com;
access_log /var/www/nginx/m.in83.com.log;
index index.htm index.html;
root /var/www/in83/m/;
location =/ {
index index.htm index.html;
root /var/www/in83/m/;
}
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
set $mobile_request '0';
if ($http_user_agent ~* '(Android|webOS|iPhone|iPod|BlackBerry)') {
set $mobile_request '1';
}
if ($mobile_request != '1') {
rewrite ^.+ http://www.in83.com$uri;
}
if (!-f $request_filename) {
proxy_pass http://115.159.142.246:2020;
break;
}
}
}
PC的配置
server {
listen 80;
server_name in83.com www.in83.com;
access_log /var/www/nginx/www.in83.com.log;
index index.htm index.html;
root /var/www/in83/www/;
location =/ {
index index.htm index.html;
root /var/www/in83/www/;
}
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if ($http_user_agent ~* '(Android|webOS|iPhone|iPod|BlackBerry)') {
set $mobile_request '1';
}
if ($mobile_request = '1') {
rewrite ^.+ http://m.in83.com$uri;
}
if (!-f $request_filename) {
proxy_pass http://115.159.142.246:2020;
break;
}
}
}
常规配置
server {
listen 80;
server_name cis.in83.com;
access_log /var/www/nginx/cis.in83.com.log;
index index.htm index.html;
root /var/www/in83/cis/;
location / {
proxy_pass http://115.159.142.246:2020;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
静态资源配置
server {
listen 80;
server_name s.in83.com;
access_log /var/www/nginx/s.in83.com.log;
index index.htm index.html;
root /var/www/in83/s/;
}