首页 > 代码库 > nginx配置

nginx配置

#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}

http {
server_names_hash_bucket_size 64;
include mime.types;
default_type application/octet-stream;
#log_format main ‘$remote_addr - $remote_user [$time_local] "$request" ‘
# ‘$status $body_bytes_sent "$http_referer" ‘
# ‘"$http_user_agent" "$http_x_forwarded_for"‘;
#access_log logs/access.log main;
#sendfile on;
ssi on;
ssi_silent_errors on;
ssi_types text/shtml;
sendfile on;
#tcp_nopush on;
#keepalive_tim eout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}


#FE
#fe-new
server {
listen 80;
autoindex on;
server_name core.pc.lietou-static.com core.ipc.lietou-static.com;
root E:/workspace/fe/core/pc/trunk;
index index.html index.htm;
if ($uri ~ /revs/(.*)$){
rewrite "^/revs(/.+?)(_[^_]{8})(\.[\w]+)$" /$1$3 last;
}
}
server {
listen 80;
autoindex on;
server_name core.h5.lietou-static.com core.ih5.lietou-static.com;
root E:/workspace/fe/core/h5/trunk;
index index.html index.htm;
location ~* \.(eot|ttf|woff|otf)$ {
add_header Access-Control-Allow-Origin *;
}
if ($uri ~ /revs/(.*)$){
rewrite "^/revs(/.+?)(_[^_]{8})(\.[\w]+)$" /$1$3 last;
}
}
server {
listen 80;
autoindex on;
server_name *.pc.lietou-static.com *.ipc.lietou-static.com;
root E:/workspace/fe/dev;
index index.html index.htm;
if ($host ~ ^(.*)\.pc\.lietou-static\.com$){
set $erji $1;
rewrite ^(.*)$ /$erji/pc/branches/20150824_zouting_automaticend/$1;
}
location / {
if ($uri ~ /revs/(.*)$){
rewrite "^(.+?)/revs(/.+?)(_[^_]{8})(\.[\w]+)$" /$1$2$4 last;
}
}
}
server {
listen 80;
autoindex on;
server_name *.h5.lietou-static.com *.ih5.lietou-static.com;
root E:/workspace/fe/dev;
index index.html index.htm;
location ~* \.(eot|ttf|woff|otf)$ {
add_header Access-Control-Allow-Origin *;
}
if ($host ~ ^(.*)\.h5\.lietou-static\.com$){
set $erji $1;
rewrite ^(.*)$ /$erji/h5/trunk/$1;
}
location / {
if ($uri ~ /revs/(.*)$){
rewrite "^(.+?)/revs(/.+?)(_[^_]{8})(\.[\w]+)$" /$1$2$4 last;
}
}
}
server {
listen 80;
autoindex on;
server_name s.lietou-static.com i.s.lietou-static.com;
root E:/workspace/dev19/pics/trunk;
index index.html index.htm index.shtml;
location / {
if ($uri ~ ^/revs/(.*)$){
rewrite "^/revs/(.+?)(_[^_]{8})(\.[\w]+)$" /$1$3;
}
}
location = /50x.html {
root html;
}
}
#pages
server {
listen 80;
autoindex on;
server_name *.pc.pages.liepin.com;
root E:/workspace/fe/dev;
index index.html index.htm index.shtml;
if ($host ~ ^(.*)\.pc\.pages\.liepin\.com$){
set $erji $1;
rewrite ^(.*)$ /$erji/pc/pages/$1;
}
location / {
if ($uri ~ /revs/(.*)$){
rewrite "^(.+?)/revs(/.+?)(_[^_]{8})(\.[\w]+)$" /$1$2$4 last;
}
}
}
server {
listen 80;
autoindex on;
server_name *.h5.pages.liepin.com;
root E:/workspace/fe/dev;
index index.html index.htm index.shtml;
if ($host ~ ^(.*)\.h5\.pages\.liepin\.com$){
set $erji $1;
rewrite ^(.*)$ /$erji/h5/pages/$1;
}
location / {
if ($uri ~ /revs/(.*)$){
rewrite "^(.+?)/revs(/.+?)(_[^_]{8})(\.[\w]+)$" /$1$2$4 last;
}
}
}

server {
listen 80;
autoindex on;
server_name 192.168.3.6;
root D:/water/html;
index index.html index.htm index.shtml;
}
server {
listen 80;
autoindex on;
server_name m.water.pages.com;
root D:/water/html;
index index.html index.htm index.shtml;
}

}

nginx配置