Home > OS >  Ubtunu16 online install nginx before operation, the reverse proxy to realize the operation
Ubtunu16 online install nginx before operation, the reverse proxy to realize the operation

Time:09-24

The first step: before installation requires use of libraries and tools
Apt to get the install build - essential libtool GCC automake autoconf make
Step 2: installing pcre, support functions of rewriting rewrite
Wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz
Tar - ZXVF pcre 8.40. Tar. Gz
CD pcre 8.40
./configure
Make & amp; & Make install
Step 3: install zlib, support gzip compression
Wget http://zlib.net/zlib-1.2.11.tar.gz
The tar ZXVF - zlib - 1.2.11. Tar. Gz
CD zlib - 1.2.11
./configure
Make & amp; & Make install
Step 4: install SSL
Wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz
The tar - ZXVF openssl - 1.0.2 o.t ar. Gz
CD openssl - 1.0.2 o
./config
Make & amp; & Make install
Step 5: install nginx
Wget http://nginx.org/download/nginx-1.13.12.tar.gz
The tar - ZXVF nginx - 1.13.12. Tar. Gz
CD nginx - 1.13.12

./configure -- sbin - path=/usr/local/nginx/nginx \
- the conf - path=/usr/local/nginx/nginx. Conf \
- pid - path=/usr/local/nginx/nginx pid \
- with - http_ssl_module \
- with - pcre=/root/pcre - 8.40 \
- with - zlib=/root/zlib - 1.2.11 \
- with openssl=/root/openssl - 1.0.2 o - source path
Make & amp; & Make install
Step 5: check whether the port 80 is being used and then start the nginx
Netstat ano | grep 80
/usr/local/nginx/nginx
Step 6: ifconfig IP browser running IP operation success
Step 7: close the firewall
Ufw disable
Step 8: the proxy server IP configuration in nginx.
in the confServer {
Listen, 80;
Server_name manage.leyou.com;

Proxy_set_header - Forwarded - Host X $Host;
Proxy_set_header X-ray Forwarded - $host Server;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

The location/{
Proxy_pass http://127.0.0.1:9001;
Proxy_connect_timeout 600;
Proxy_read_timeout 600;
}
}
Server {
Listen, 80;
Server_name api.leyou.com;

Proxy_set_header - Forwarded - Host X $Host;
Proxy_set_header X-ray Forwarded - $host Server;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

The location/{
Proxy_pass http://127.0.0.1:10010; - write in front of the virtual machine IP local CMD virtual IP
Proxy_connect_timeout 600;
Proxy_read_timeout 600;
}
}
Step 9: the Switch IP Hosts agent virtual machine ifcongfig IP
Step 10: reload nginx/usr/local/nginx/nginx -s reload
Ping manage.leyou.com see if loading virtual machine
Ten step: run the client program can, for example manage.leyou.com/#/
-- -- -- -- -- -- -- -- -- -- -- -- -- --
Effective method to kill process 80 port: sudo fuser - 80 k/TCP



  • Related