反向代理

  1. server {
  2. listen 9001;
  3. server_name 192.168.88.128;
  4. location ~ /edu/ {
  5. proxy_pass http://127.0.0.1:8080;
  6. }
  7. location ~ /vod/ {
  8. proxy_pass http://127.0.0.1:8081;
  9. }
  10. }

负载均衡

  1. upstream myserver {
  2. server 192.168.17.129:8080;
  3. server 192.168.17.129:8081;
  4. }
  1. server {
  2. listen 80;
  3. server_name 192.168.88.128;
  4. #charset koi8-r;
  5. #access_log logs/host.access.log main;
  6. location / {
  7. proxy_pass http://myserver;
  8. root html;
  9. index index.html index.htm;
  10. }
  11. }

动静分离**

  1. location /www/ {
  2. root /data/;
  3. index index.html index.htm;
  4. }
  5. location /image/ {
  6. root /data/;
  7. # 会列出所有文件
  8. autoindex on;
  9. }