Ubuntu 16.04
- 参考文档
更新系统
12sudo apt-get updatesudo apt-get upgrade安装Nginx的依赖包 zlib pcre openssl(可以源码安装也可以直接系统安装)
12sudo apt-get install libpcre3 libpcre3-dev zlib1g-dev libssl-dev build-essentialsudo apt-get install openssl
编译安装Nginx
http://nginx.org/download/nginx-1.10.3.tar.gz
1234tar -zxvf nginx-1.10.3.tar.gzcd nginx-1.10.3sudo ./configure --prefix=/usr/local/nginx --with-openssl=/usr/include/openssl --with-streamsudo make && sudo make install
修改conf/nginx.conf
123456789101112131415161718worker_processes auto;#error_log /var/log/nginx/error.log info;events {use epoll;worker_connections 1024;}stream {upstream backend {server 127.0.0.1:9990 weight=1;server 127.0.0.1:9991 weight=1;}server {listen 127.0.0.1:12345;proxy_connect_timeout 60s;proxy_timeout 60s;proxy_pass backend;}}运行Nginx
12cd /usr/local/nginx/sbinsudo ./nginx