Nginx1.15.5安裝
Nginx1.15.5安裝
#wget http://nginx.org/download/nginx-1.15.5.tar.gz
#wget http://nginx.org/download/nginx-1.15.5.tar.gz.asc
#gpg --verify nginx-1.15.5.tar.gz.asc nginx-1.15.5.tar.gz
# gpg --keyserver pgpkeys.mit.edu --recv-key A1C052F8
# tar -xzvf nginx-1.15.5.tar.gz -C /soft
# groupadd nginx
# useradd nginx -g nginx -s /sbin/nologin -M
//創(chuàng)建緩存目錄在/var/tmp/nginx/
[root@7Core ~]# mkdir -pv /var/tmp/nginx/{client_body,proxy,fastcgi,uwsgi,scgi}
//賦予Nginx用戶權(quán)限
[root@7Core ~]# chown -R nginx:nginx /var/tmp/nginx/
//創(chuàng)建日志目錄在/usr/local/nginx/
[root@7Core ~]# mkdir -pv /usr/local/nginx/logs
//賦予Nginx用戶權(quán)限
[root@7Core ~]# chown -R nginx:nginx /usr/local/nginx/
# yum -y install gcc gcc-c++ autoconf automake make wget vim
# yum -y install openssl openssl-devel libxml2-devel libxslt-devel perl-devel perl-ExtUtils-Embed libtool zlib zlib-devel pcre pcre-devel patch
另外一種安裝方案:
# yum -y install gcc* pcre* pcre-devel* zlib* zlib-devel* openssl* openssl-devel*
當(dāng)前目錄為:/soft/waresoft/nginx
# wget https://ftp.pcre.org/pub/pcre/pcre-8.42.tar.gz
# tar -zxvf pcre-8.42.tar.gz
#cd pcre-8.42/ && ./configure && make && make install && cd ..
# wget https://www.openssl.org/source/openssl-1.1.1-pre8.tar.gz
# tar -zxvf openssl-1.1.1-pre8.tar.gz
# cd openssl-1.1.1-pre8 && ./config && make && make install && cd ..
# wget https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/master.tar.gz
# tar -zxvf master.tar.gz
# mv nginx-goodies-nginx-sticky-module-ng-08a395c66e42/ nginx-sticky-module/
#mv nginx-sticky-module/ /soft/nginx-1.15.5/
# ./configure \
--prefix=/usr/local/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_xslt_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_random_index_module \
--with-http_degradation_module \
--with-http_secure_link_module \
--with-http_gzip_static_module \
--with-http_perl_module \
--add-module=../nginx-sticky-module \
--with-pcre=../pcre-8.42 \
--with-zlib=../zlib-1.2.11 \
--with-openssl=../openssl-1.1.1-pre8 \
--with-file-aio \
--with-mail \
--with-mail_ssl_module \
--http-client-body-temp-path=/var/tmp/nginx/client_body \
--http-proxy-temp-path=/var/tmp/nginx/proxy \
--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
--http-scgi-temp-path=/var/tmp/nginx/scgi \
--with-stream \
--with-ld-opt="-Wl,-E"
SSL安裝
#./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-openssl=/usr/local/ssl
# make && make install
# vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=nginx - high performance web server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/usr/sbin/nginx -s stop
[Install]
WantedBy=multi-user.target
# chmod 754 /usr/lib/systemd/system/nginx.service
# systemctl start nginx
# systemctl enable nginx
# systemctl daemon-reload
# systemctl status nginx
想了解更多?現(xiàn)在就開始免費(fèi)體驗(yàn)