一、源码包安装以前,首页安装依赖包nginx
yum -y install gcc gcc-c++ make libtool zlib zlib-devel openssl openssl-devel pcre pcre-devel
二、去nginx官网去下载稳定版安装包c++
wget http://nginx.org/download/nginx-1.14.2.tar.gz
三、解压缩vim
tar -zxvf nginx-1.14.2.tar.gz
三、编译安装服务器
cd nginx-1.14.2 ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre make && make install
四、nginx相关命令code
/usr/local/nginx/sbin/nginx # 启动 /usr/local/nginx/sbin/nginx -s stop #中止 /usr/local/nginx/sbin/nginx -s reload #从新加载配置
五、将nginx加入环境变量ip
vim /etc/profile export NGINX_HOME=/usr/local/nginx export PATH=$PATH:$NGINX_HOME/sbin
六、检测nginx安装ssl
nginx -v # 命令检测 http://服务器ip # 网页检测
网页检测可能失败,由于防火墙get
七、关闭防火墙源码
systemctl start firewalld #启动 systemctl stop firewalld #关闭 systemctl status firewalld #查看状态 systemctl disable firewalld # 开机禁用 systemctl enable firewalld #开机启用