安装依赖

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_format html;  #以html风格展示目录
autoindex_exact_size off; #切换为off后以可读的方式显示文件大小 autoindex_localtime on; #以文件时间为显示时间
        charset "utf-8,gbk"; #展示中文 }

 创建download目录

[root@bogon conf]# mkdir -p /usr/local/nginx/html/download

 启动nginx

$ cd /usr/local/nginx/sbin
# 检查配置文件是否有报错
$ ./nginx -t
$ ./nginx -s reload

 

 

 

posted on 2022-08-22 16:23  属于我的梦,明明还在  阅读(17)  评论(0)    收藏  举报