一、安装前提
1.需要操作系统内核需要在2.6版本以上,因为Linux2.6及以上内核才支持epoll,而nginx高并发需要用到epoll
查询linux的内核版本uname-aLinux myserver3.10.0-693.el7.x86_64#1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux2.关闭防火墙
systemctl status firewalld systemctl stop firewalld systemctl status firewalld3.关闭selinux
sestatusvim/etc/selinux/config 将SELINUX由enforcing修改为disabled setenforce0getenforce二、安装依赖
yuminstall-ygcc yuminstall-ypcre pcre-devel yuminstall-yzlib zlib-devel yuminstall-yopenssl openssl-devel yuminstall-ygcc pcre pcre-devel zlib zlib-devel openssl openssl-devel三、编译安装
- 将安装包解压到文件夹中,然后cd进入安装包nginx文件夹
tar-xzvfnginx-1.14.2.tar.gzcdnginx-1.14.2/ auto CHANGES CHANGES.ru conf configure contrib html LICENSEmanREADME src2.编译(带参数)
配置模块
./configure--prefix=/usr/local/nginx\--sbin-path=/usr/local/nginx/sbin/nginx\--modules-path=/usr/local/nginx/modules\--conf-path=/usr/local/nginx/conf/nginx.conf\--error-log-path=/usr/local/nginx/logs/error.log\--http-log-path=/usr/local/nginx/logs/access.log\--pid-path=/usr/local/nginx/logs/nginx.pid\--lock-path=/usr/local/nginx/logs/nginx.lock编译&编译安装
make&&makeinstall