nginx 反向代理

第一种(访问IP转发到IP+端口)

例子

server{
  listen  9003;
  server_name  192.168.1.114;
  index  index.php index.html index.htm;

  location / {
     proxy_pass  http://127.0.0.1:9002;
  }
}

当访问192.168.1.114:9003 的时候, 就会转发到192.168.1.114的9002端口, 9002端口我配置的是PHPinfo(); 所以最终会显示PHPinfo的信息.

 

 

user nginx;
worker_processes 1;
pid /run/nginx.pid;

error_log /var/log/nginx/error.log;

include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

rtmp {
    access_log logs/access.rtmp.log;

    server {
        listen 1891;
        #chunk_size 4000;
        application video {
            play /mnt/hgfs/paperless/PF/File/;
        }
        application live {
            live on;
        }
    }

    server {
        listen 1935;
        application live {
            live on;
            wait_key on;
            hls_continuous on;
            hls_cleanup on;
            hls_nested on;
        }

        application hls {
            live on;
            hls on;
            hls_path /usr/share/nginx/temp/hls;
            hls_fragment 8s;
        }
    }

}


http {
    include mime.types;
    server {
        listen 1892;
        root   /mnt/hgfs/paperless/PF/File/;
        location .~ {
            #on_connect http://172.16.9.225:5091/app/index/d;
           mp4;
           mp4_buffer_size 10m;
           mp4_max_buffer_size 50m;
        }
    }
  server {
        listen 808;
        server_name  192.168.3.95;
                   index index.php index.html  index.htm;
        location /{
           proxy_pass http://127.0.0.1:5000;
        }
    }

    server {
        listen      8080;

        location / {
            root html;
        }

        location /stat {
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }

        location /stat.xsl {
            root html;
        }

        location /hls {
            #server hls fragments
            types{
                application/vnd.apple.mpegurl m3u8;
                video/mp2t ts;
            }
            alias temp/hls;
            expires -1;
        }

    }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值