yum install -y gcc-c++ pcre pcrre-devel zlib zlib-devel openssl openssl-devel
? 官网下载链接:nginx: download
? 命令下载:
wget http://nginx.org/download/nginx-1.24.0.tar.gz
# tar -zxvf nginx-1.24.0.tar.gz
# cd nginx-1.24.0
# ./configure
# make & make install
命令正常执行后 会在/usr/local/目录下生成nginx目录
/usr/local/nginx/conf 目录下为Nginx配置文件nginx.conf
/usr/local/nginx/sbin 目录下为Nginx执行程序
cd /usr/local/nginx/sbin
nginx -s reload
注:修改nginx-conf 配置文件后 需要执行nginx -s reload 完成配置重载
出现启动问题
[root@71bbc89bd68f sbin]# ./nginx -s reload
nginx: [alert] kill(3042, 1) failed (3: No such process)
或者
[root@71bbc89bd68f sbin]# nginx -s reload
-bash: nginx: command not found
[root@71bbc89bd68f sbin]# ps -ef | grep nginx
root 26291 26268 0 02:40 pts/2 00:00:00 grep --color=auto nginx
vim /etc/profile
添加
PATH=$PATH:/usr/local/nginx/sbin
export PATH
刷新配置文件
source /etc/profile
重启nginx
nginx -s reload