Coder Social home page Coder Social logo

nginx_autoindex's Introduction

nginx_autoindex 美化模板

预览

image-20230913154626086

image-20230913154654152

image-20230913154716065

如果不喜欢你们可以自己调整色彩这些.

软件下载这个自己修改,

使用

搭配nginx使用.

nginx配置如下

	server {
		listen  809;
		server_name  localhost;
		
		charset utf-8;
		
		location / {
			root f:\\soft\\.theme\\;
			index index.html;
		}
		
		location /json/ {
			alias f:\\soft\\;
			index json;
			autoindex on;
			autoindex_format json;		
			autoindex_localtime on;
			autoindex_exact_size off;
			
			add_header  Access-Control-Allow-Origin "*";
			add_header  Access-Control-Allow-Methods "GET, POST, OPTIONS";
			add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
			add_header  Access-Control-Allow-Credentials true;
		}
		
		 
		error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
	}

关于跨域访问的问题,没有测试,应该问题不大.

把这css,js,index.html 文件复制到需要暴露的目录,推荐在该目录下创建 .theme 文件夹(注意这个文件夹前面有个点).然后按照上面的配置配置好nginx.

配置好nginx记得重载一下,linux下就是

$ nginx -s reload  

windows

$ cd x:\younginx\
$ dir
... nginx.exe ... 就是切换到可以看到nginx.exe 这个位置
$ nginx -t   # 测试下配置文件是否正确
$ taskkill -f -im nginx.exe 结束nginx进程
$ nginx   再启动,这里不一定是这个命令.我自己开发的是 nginx-service restart ,
一般都是直接启动这个
❯❯❯ 16:10:02  D:\桌面 ❯❯❯ cd F:\apps\nginx\
❯❯❯ 16:10:05  F:\apps\nginx ❯❯❯ .\nginx.exe

什么是配置好?

就是当你输入URL/json/ 返回的是json数据,输入URL打开的是我这个index模板.

image-20230913161157314

就这样就可以了.

这个后期维护只是自定义一些color样式什么的.而且是不定期.

nginx_autoindex's People

Contributors

xyz349925756 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.