共计 1106 个字符,预计需要花费 3 分钟才能阅读完成。
user root;
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 {
include mime.types;
# gzip on;
# gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
# 负载平衡
# upstream mysite.com {
# server localhost:8081;
# server localhost:8082;
# server localhost:8083;
# server localhost:8084;
# server localhost:8085;
# hash $request_uri;
# }
server {
listen 8080;
server_name localhost;
# hash mode
location / {
root /srv/;
index index.html;
}
# history mode
# location / {
# root /srv/;
# try_files $uri $uri/ /index.html;
# }
# api proxy
# location ^~ /api/ { # 留神开端的 "/"
# proxy_pass http://mysite.com/; # 留神开端的 "/"
# }
# socket proxy
# location ^~ /socket/ {
# proxy_pass http://mysite.com/socket/;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
# }
}
# 负载平衡
# server {
# listen 8081;
# server_name localhost;
# location / {
# proxy_pass http://ip1.com;
# }
# }
# server {
# listen 8082;
# server_name localhost;
# location / {
# proxy_pass http://ip2.com;
# }
# }
}
正文完