Docs/linux基础/nginx/配置nginx转发.md

890 B
Raw Blame History

修改/usr/local/nginx/conf/nginx.conf
(如果需要转发的网站较多,为方便查询,可以在目录中添加对应的配置文件(建议新建目录放配置文件)
如vhost_test.iboxpay.com.conf
添加如下内容

 server {
        listen       80;
        server_name test.iboxpay.com;
        rewrite ^/(.*)$ http://$server_name/test/ last;
        location /test/ {
            proxy_pass  http://192.168.100.100:8080/test/;  ##nat地址:端口
            access_log  /usr/local/nginx/logs/insurex_access.log  main;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_connect_timeout 90;
            proxy_send_timeout 90;
            proxy_read_timeout 90;
            client_max_body_size 10m;
        }
    }