Linux上安装tenginx

1.下载tengine:http://tengine.taobao.org/download_cn.html
2.将文件上传到/opt/tengine的目录上(tengine目录是自定义目录)
Linux上安装tenginx
3.解压包,并进入解压后的文件目录下
4.编译环境准备
一键安装四个依赖

yum -y install gcc gcc-devel pcre pcre-devel openssl openssl-devel

执行命令

./configure

编译

make

sed -e "s|%%PREFIX%%|/usr/local/nginx|" \
        -e "s|%%PID_PATH%%|/usr/local/nginx/logs/nginx.pid|" \
        -e "s|%%CONF_PATH%%|/usr/local/nginx/conf/nginx.conf|" \
        -e "s|%%ERROR_LOG_PATH%%|/usr/local/nginx/logs/error.log|" \
        < man/nginx.8 > objs/nginx.8

安装

  make install

将 /usr/local/nginx/sbin目录 添加到path环境变量中

vi ~/.bash_profile

如图:
Linux上安装tenginx
生效

source ~/.bash_profile

nginx命令

   nginx -m 显示所有加载的模块
   nginx -l 显示所有可以使用的指令
   nginx -t 检查nginx的配置文件是否正确
   nginx -s start 启动nginx
   nginx -s reload 重启nginx
   nginx -s stop 停止nginx
   ps -ef | grep nginx  //查看进程命令

linux负载均衡配置

upstream a {
		server 192.168.1.3:8761;
		server 192.168.1.238:8761;
	}
	

location / {
	#root   html;
	#index  index.html index.htm;
	proxy_pass http://a;
}

如图:
Linux上安装tenginx