nginx proxy of four

nginx achieved through four port forwarding agent

Need two virtual machines, one to be the nginx proxy (installed --with-stream module 192.168.200.113), used as a test access (installation of nginx, write test text 192.168.200.112), the purpose is accessed via a proxy machine 300 port can be accessed 80-port tester.

Tester is the Web server, nginx port 80, the port 80 of apache, tomcat 8080 port.

 

A, nginx proxy machine (192.168.200.113)

[root@localhost ~]# yum -y install pcre-devel zlib-devel openssl-devel
[root@localhost ~]# useradd -M -s /sbin/nologin nginx
[root@localhost ~]# tar -xf nginx-1.15.9.tar.gz -C /usr/src/
[root@localhost ~]# cd /usr/src/nginx-1.15.9/
编译安装,安装所需模块
[root@localhost ~]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-stream && make && make install    

[root@localhost ~]# ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/
[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
{Events
    worker_connections   1024 ; 
} Stream { 
    Server { 
       the listen

 300;      // through port 300 to access the machine 
       proxy_pass 192.168.200.112:80;     // access to port 80 on the host 112 
    } 
}

 
HTTP { 
    the include the mime.types; 
    default_type file application / OCTET - Uninterpreted Stream; 

[the root @ localhost ~] # Nginx

 

Second, install nginx

Omit the installation process, the preparation of test file as follows:

[root@localhost ~]# cat /usr/local/nginx/html/index.html 
bbbbbb

 

Third, the test

 

Guess you like

Origin www.cnblogs.com/tanxiaojuncom/p/11640082.html