Nginx 安装
Nginx下载地址:https://nginx.org/en/download.html
一、安装前
1.安装编译工具 以及依赖文件
(编译依赖gcc环境;;
yum install gcc-c++
zlib库提供多种压缩解压缩方式 Nginx使用zlib对http包内容进行gzip;
yum install zlib zlib-devel;
openSSL是一个安全套接字密码库,囊括很多密码算法、常用的密钥、证书封装管理功能以及SSL协议,nginx支持http也支持https;)
yum install -y openss openssl-devel;
也可以一次安装到位,如下
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
2.接着安装pre
cd /usr/local/
wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
tar -zxvf pcre-8.35.tar.gz
cd pcre-8.35
./configure
make && make install
mkdir /opt/module/ /opt/software/
二、开始安装
将下载好的安装包解压
tar -zxvf nginx-1.20.1.tar.gz -C /opt/module/
./configure --prefix=/opt/module/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/pcre-8.35
make
make install
三、操作
Nginx基本操作命令
启动
./nginx
停止
./nginx -s stop
安全退出
./nginx -s quit
重新加载配置文件
./nginx -s reload
查看Nginx进程
ps aux|grep nginx
如果开了防火墙则需要开放端口80,查看如下文章
https://blog.csdn.net/weixin_44982675/article/details/109007496