配置nginx目录游览功能

cat jingxiang.conf
server {
        listen       80;
        server_name  jingxiang.zqfstack.com;
        location / {
                root /data/jingxiang;
                index  index.html index.htm;

        }

        location /centos/ {
                root /data/jingxiang;
                charset utf-8;
                autoindex on; #开启目录游览功能
                autoindex_exact_size off;  #显示大小
                autoindex_localtime on;   #显示时间
        }
}


mkdir /data/jingxiang/centos -p
cat /data/jingxiang/index.html
<!DOCTYPE html>
<html>
<head>
<title>Welcome to myjingixang!</title>

<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>

</head>

<body>
<h1>Welcome to myjingxinag!</h1>

<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to

<p><em>Thank you for using myjingxiang.</em></p>

</body>

</html>

cp /usr/sbin/* /data/jingxiang/centos/

20250819151441
20250819151427

posted @ 2025-08-14 17:56  阿峰博客站  阅读(8)  评论(0)    收藏  举报