欢迎来到 一木浮生 的博客

人生三重境界:昨夜西风凋碧树,独上高楼,望尽天涯路。 衣带渐宽终不悔,为伊消得人憔悴。 众里寻他千百度,蓦然回首,那人却在灯火阑珊处。
扩大
缩小

Nginx编译安装

一、前言

  (一)、概述

   Nginx是一个高性能的HTTP和反向代理服务,也是一个IMAP/POP3/SMTP服务器。第一个公开版本0.1.0发布于2004年10月4日;其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名;Nginx是一款轻量级的Web服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like协议下发行,其特点是占有内存少,并发能力强;

  (二)、预处理

配置环境
  OS:CentOS 7.5 64bit
  Nginx版本:
1.14.0   hostname:nginx-1-1   ip:10.18.43.141
[root@nginx-1-1 ~]# systemctl stop firewalld
[root@nginx-1-1 ~]# sed -ri '/^SELINUX=*/cSELINUX=disabled' /etc/selinux/config
[root@nginx-1-1 ~]# setenforce 0
[root@nginx-1-1 ~]# mkdir -p /data/nginx
[root@nginx-1-1 ~]# wget -P /data/nginx/ http://nginx.org/download/nginx-1.14.0.tar.gz
[root@nginx-1-1 ~]# cd /data/nginx/

二、安装

  (一)、环境部署

[root@nginx-1-1 nginx]# yum -y install pcre-devel openssl-devel libxml2-devel libxslt-devel gcc
[root@nginx-1-1 nginx]# tar xf nginx-1.14.0.tar.gz
[root@nginx-1-1 nginx]# cd nginx-1.14.0/

[root@nginx-1-1 nginx-1.14.0]# groupadd nginx
[root@nginx-1-1 nginx-1.14.0]# useradd -r -g nginx -s /sbin/nologin nginx

  (二)编译安装

[root@nginx-1-1 nginx-1.14.0]# ./configure \
--prefix=/usr/local/nginx \
--without-select_module --without-poll_module \
--with-debug \
--with-http_ssl_module --with-http_realip_module \
--with-http_addition_module --with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_xslt_module \
--with-http_gzip_static_module --with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_stub_status_module \
--with-cc=`which gcc`

执行编译

[root@nginx-1-1 nginx-1.14.0]# make -j 2 && make install

三、启动使用

  (一)、启动测试

[root@nginx-1-1 ~]# /usr/local/nginx/sbin/nginx 
[root@nginx-1-1 ~]# ss -an | grep :80
tcp    LISTEN     0      128       *:80                    *:*   

  (二)、配置开机自启动

[root@nginx-1-1 ~]# echo "/usr/local/nginx/sbin/nginx" >> /etc/rc.local
[root@nginx-1-1 ~]# chmod a+x /etc/rc.d/rc.local
[root@nginx-1-1 ~]# echo 'export PATH=$PATH:/usr/local/nginx/sbin' >> /etc/profile
[root@nginx-1-1 ~]# source /etc/profile

 

posted on 2018-07-25 21:31  一木浮生  阅读(248)  评论(0编辑  收藏  举报

导航