<p>1、源码包安装之前,首页安装依赖包</p><pre class="brush:bash;toolbar:false">yum-yinstallgccgcc-c++makelibtoolzlibzlib-developensslopenssl-develpcrepcre-devel</pre><p>2、去nginx官网去下载稳定版安装包</p><pre class="brush:bash;toolbar:false">wgethttp://nginx.org/download/nginx-1.14.2.tar.gz</pre><p>3、解压缩</p><pre class="brush:bash;toolbar:false">tar-zxvfnginx-1.14.2.tar.gz</pre><p>3、编译安装</p><pre class="brush:bash;toolbar:false">cdnginx-1.14.2
./configure--prefix=/usr/local/nginx--with-http_stub_status_module--with-http_ssl_module--with-pcre
make&&makeinstall</pre><p>4、nginx相关命令</p><pre class="brush:bash;toolbar:false">/usr/local/nginx/sbin/nginx#启动
/usr/local/nginx/sbin/nginx-sstop#停止
/usr/local/nginx/sbin/nginx-sreload#重新加载配置</pre><p>5、将nginx加入环境变量</p><pre class="brush:bash;toolbar:false">vim/etc/profile
exportNGINX_HOME=/usr/local/nginx
exportPATH=$PATH:$NGINX_HOME/sbin</pre><p>6、检测nginx安装</p><pre class="brush:bash;toolbar:false">nginx-v#命令检测</pre><p>http://服务器ip # 网页检测</p><p>网页检测可能失败,因为防火墙</p><p>7、关闭防火墙</p><pre class="brush:bash;toolbar:false">systemctlstartfirewalld#启动
systemctlstopfirewalld#关闭
systemctlstatusfirewalld#查看状态
systemctldisablefirewalld#开机禁用
systemctlenablefirewalld#开机启用</pre>