1、源码包安装之前,首页安装依赖包
yum -y install gcc gcc-c++ make libtool zlib zlib-devel openssl openssl-devel pcre pcre-devel
2、去nginx官网去下载稳定版安装包
wget http://nginx.org/download/nginx-1.14.2.tar.gz
3、解压缩
tar -zxvf nginx-1.14.2.tar.gz
3、编译安装
cd nginx-1.14.2
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre
make && make install
4、nginx相关命令
/usr/local/nginx/sbin/nginx # 启动
/usr/local/nginx/sbin/nginx -s stop #停止
/usr/local/nginx/sbin/nginx -s reload #重新加载配置
5、将nginx加入环境变量
vim /etc/profile
export NGINX_HOME=/usr/local/nginx
export PATH=$PATH:$NGINX_HOME/sbin
6、检测nginx安装
nginx -v # 命令检测
http://服务器ip # 网页检测
网页检测可能失败,因为防火墙
7、关闭防火墙
systemctl start firewalld #启动
systemctl stop firewalld #关闭
systemctl status firewalld #查看状态
systemctl disable firewalld # 开机禁用
systemctl enable firewalld #开机启用
原文地址:https://www.cnblogs.com/fengchi/p/10585467.html
时间: 2024-09-29 12:06:50