- 下载解压
- 官网地址: nginx: download
- 下载稳定版中的,Linux版本
- 解压缩
tar -zxvf nginx-1.22.1.tar.gz
- 安装依赖
yum install -y openssl* & yum -y install ncurses-devel - 打开解压缩的nginx目录,配置编译
cd /nginx-1.22.1
./configure
make
make install
./configure配置的过程中会输出的信息,里面包含配置文件启动文件等信息
- 检查nginx 默认安装路径,如下图安装在 /usr/local/nginx 路径下
whereis nginx - cd /usr/local/nginx 这里面可以配置和启动 ngxin
配置文件位于:config/nginx.conf
启动: sbin/nginx - 建立开机启动文件
vi /etc/systemd/system/nginxd.service
- 加入开机启动
systemctl enable nginxd