nginx rewrite

nginx rewrite

  1. rewrite规则
  1. 示例1:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    [root@192 vhost]# cat zabbix.conf
    # zabbix
    server {
    listen 80;
    server_name zabbix.test.cn;

    location / {
    rewrite ^/ http://zabbix.test.cn/zabbix/;
    }

    location /zabbix {
    proxy_pass http://192.168.13.202;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    access_log /mnt/log/nginx/zabbix.test.cn.log main;
    }