#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
upstream wanghongguo {
server 127.0.0.1:9002 weight=1;
# server 127.0.0.1:8080 weight=1;
}
# HTTP server
server {
listen 88;
server_name localhost;
location / {
root html;
index index.html;
proxy_pass http://wanghongguo;
}
}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
- 负载均衡的配置
upstream wanghongguo {
server 127.0.0.1:9002 weight=1;
# server 127.0.0.1:8080 weight=1;
}
- 反向代理的配置
server {
listen 88;
server_name localhost;
location / {
root html;
index index.html;
proxy_pass http://wanghongguo;
}
}
访问 http://localhost:88 会代理到 http://wanghongguo
- Http server配置默认端口是80
- Https server配置默认端口是443
本地静态文件配置
server {
listen 8081;
server_name localhost;
location /satellite {
add_header 'Access-Control-Allow-Origin' '*';
alias E:/MapImage/bingmaps/satellite;
}
}