NGINX目录索引

一.关闭防火墙和SElinuxhtml

systemctl stop firewalld
setenforce 0

二.源码安装NGINX
下载源码包并解压:linux

wget http://nginx.org/download/nginx-1.16.0.tar.gz
tar -zxvf nginx-1.16.0.tar.gz

三.编译安装nginx

cd /usr/local/src
cd nginx-1.16.0
./configure  --prefix=/data/server/nginx
make && make install

进到NGINX目录中启动NGINXvim

cd /data/server/nginx/sbin
./nginx

在网页输入IP:
NGINX目录索引
配置目录索引浏览器

  1. 在/var/www/html目录下建立文件www xxx yyy
    cd /var/www/html
    touch www xxx yyy
    2.分别在www xxx yyy三个文件内加入安装包
    vim www
    在其中放入安装连接http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz

vim xxx
在其中放入安装连接http://nginx.org/en/download.htmlide

3.配置文件
vim /data/server/nginx/conf/nginx.confcode

在server模块下添加
          autoindex on;
        autoindex_exact_size off;
      autoindex_localtime on;
      root   /var/www/html;
在location下添加
        autoindex on;
        autoindex_exact_size off;
      autoindex_localtime on;

NGINX目录索引

4.进到启动nginx的目录
cd /data/server/nginx/sbinserver

5.重读nginx
./nginx -s reload
6.在浏览器输入ip
NGINX目录索引htm

相关文章
相关标签/搜索