NGINX目录索引

一.关闭防火墙和SElinux

systemctl stop firewalld
setenforce 0

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

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

三.编译安装

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

进到NGINX目录中启动NGINX

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.html

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

在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/sbin

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值