linux部署安装nginx
一、下载安装包
wget --no-check-certificate https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/master.tar.gz
wget http://nginx.org/download/nginx-1.12.2.tar.gz
二、解压
tar -zxvf master.tar.gz
mv nginx-goodies-nginx-sticky-module-ng-08a395c66e42/ nginx-sticky
tar -zxvf nginx-1.12.2.tar.gz
三、关闭防火墙
getenforce
setenforce 0
四、安装基础环境
yum -y install gcc-c++ autoconf automake
yum -y install libxml2 libxml2-dev
yum -y install libxslt-devel
yum -y install openssl openssl-devel
yum install gd-devel -y
yum -y install perl-devel perl-ExtUtils-Embed
yum -y install GeoIP GeoIP-devel GeoIP-data
yum install libxslt libraries
#可选
#wget http://rpmfind.net/linux/centos/7.4.1708/os/x86_64/Packages/libxml2-devel-2.9.1-6.el7_2.3.x86_64.rpm
#rpm -ivh libxml2-devel-2.9.1-6.el7_2.3.x86_64.rpm
五、修改配置文件(进入NGINX的安装目录-执行完成后输入echo $?验证,返回值为0表示执行成功)
./configure --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-http_auth_request_module --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-debug --add-module=/opt/tmp/nginx-sticky/
六、安装
make & make install
useradd -s /sbin/nologin -M nginx
mkdir -pv /var/lib/nginx/tmp/client_body
七、启动NGINX
nginx
八、关闭NGINX
nginx -s stop
九、查看监听端口
ss -tnlp|grep nginx
十、修改配置文件
vim /etc/nginx/nginx.conf
在文件的http {}中添加修改: