安装依赖
yum -y install gcc gcc-c++ automake zlib zlib-devel \ openssl openssl–devel pcre pcre-devel
下载解压部署包
tar -xvf nginx-1.22.0.tar.gz -C /usr/local/
编译安装
[root@bogon local]# cd nginx-1.22.0/ [root@bogon nginx-1.22.0]# ./configure [root@bogon nginx-1.22.0]# make && make install
修改nginx.conf配置文件
location / { root /usr/local/nginx/html/download; autoindex on; autoindex_exact_size off; autoindex_localtime on; }
创建download目录
[root@bogon conf]# mkdir -p /usr/local/nginx/html/download
启动nginx
$ cd /usr/local/nginx/sbin # 检查配置文件是否有报错 $ ./nginx -t $ ./nginx -s reload