1.安装说明: 系统环境:Ubuntu 14.04.3 LTS 软件:nginx-1.8.0.tar.gz 安装位置:/opt/nginx
2.安装 需要用到的安装包: openssl-fips-2.0.10.tar.gz zlib-1.2.8.tar.gz pcre-8.37.tar.gz nginx-1.8.0.tar.gz 安装顺序依次为:openssl、zlib、pcre, 然后安装Nginx包
2.1安装openssl-fips-2.0.2.tar.gz tar –zxvf openssl-fips-2.0.10.tar.gz cd openssl-fips-2.0.10 ./config make make install 2.2 安装zlib-1.2.8.tar.gz tar –zxvf zlib-1.2.8.tar.gz cd zlib-1.2.8 ./configure make make install
2.3安装pcre-8.37.tar.gz (需安装编译c++环境: apt-get install build-essential) 在安装pcre-8.37.tar.gz之前需要安装c++编译环境,否则在执行./configure时会报错。 apt-get install build-essential
tar –zxvf pcre-8.37.tar.gz cd pcre-8.37 ./configure make make install
2.4安装nginx-1.8.0.tar.gz tar -zxvf nginx-1.8.0.tar.gz cd nginx-1.8.0 ./configure --with-pcre=../pcre-8.37 --with-zlib=../zlib-1.2.8 --with-openssl=../openssl-fips-2.0.10 make make install 至此Nginx的安装完成! 检测nginx是否安装成功 cd /usr/local/nginx/sbin ./nginx –t 出现如下所示提示,表示安装成功 root@wcyong :/usr/local/nginx/sbin# ./nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
启动nginx ./ngixn 查看端口: netstat -tnlp | grep nginx root@wcyong :/usr/local/nginx/sbin# netstat -tnlp | grep nginx tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2957/nginx
并且通过浏览器访问
3.nginx负载均衡配置 打开 /usr/local/nginx/conf/nginx.conf 配置文件,做如下配置即可:
(责任编辑:IT) |