nginx配置域名跳轉到指定專案
阿新 • • 發佈:2019-01-10
如www.abc.com跳轉到192.168.3.30/cms。
location / {
rewrite / /cms;
}
http { 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; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 300; client_max_body_size 1024M; #gzip on; upstream cms{ server 127.0.0.1:8081; } upstream site{ server 127.0.0.1:8083; } upstream pd{ server 127.0.0.1:8084; } upstream pb{ server 127.0.0.1:8082; } server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location /cms { index index; proxy_pass http://cms ; proxy_connect_timeout 3600s; proxy_send_timeout 3600s; proxy_read_timeout 3600s; } location /site { index index; proxy_pass http://site ; } location /pb { index index; proxy_pass http://pb ; } location /pd { index index; proxy_pass http://pd ; } location / { rewrite / /cms; } location /zp{ root D:/html; index index.html; }