nginx + Microsoft edge 竟然还能这么玩!

1次阅读
没有评论
  • 使用软件介绍
    nginx 虽然没有 F5 那么强大,也不是只有服务器才能使用。在Windows 系统上表现也不俗!
    我使用 nginx 搭建 web 服务,并利用 nginx 提供的 api 实现了文件浏览功能。 既然是 web 肯定离不开浏览器。我使用的是 Microsoft edge ,Google chrome 也可以。

    很多人只看到了是一个网页,难道里面含有 代{过}{滤}理 上网的也看不到,Google 翻译,Docker 加速等等功能看不到?

  • 效果图预览
    默认页面是搜索集合

    我常用的Ai,有需要可以修改我的 html 源码添加

    我自己搭建的服务,里面有代{过}{滤}理,Google(有些运营商的IP不纯会出现访问受限的情况),Google translate,Docker Agent,等 web 服务。

    这里是检测访问者的出口 IP ,仅供参考。和访问我的代{过}{滤}理服务器是否联通的检测结果展示。

    这里是我本地使用 nginx 搭建的服务,这里面有 epub 阅读器。浏览器 epub 插件也可以直接打开epub电子书但是翻译扩展不能使用!

  • 功能介绍

    epub电子书阅读,在服务里面也有一个 https://neat-reader.cloudb.pub/
    可以实时的翻译不清楚的单词或者段落。有三种方法可以使用

    第一种谷歌翻译插件划词翻译,第二种chatgpt翻译,第三种沉浸式翻译。 (以前发布过电子阅读器的搭建 https://www.52pojie.cn/thread-1832141-1-1.html)
    官网支持云存储:https://www.neat-reader.cn

    沉浸式翻译插件: https://immersivetranslate.com/?via=xyz349925756

    web 实现的本地计算机上目录浏览的功能

    nginx 设置
    [Shell] 纯文本查看 复制代码

    server {
    listen 810;
    server_name localhost;

    charset utf-8;

    location / {
    root F:\\ISO\\.theme\\;
    index index.html;
    }

    location /json/ {
    alias F:\\ISO\\;
    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;
    }
    }

    更多设置需要自己去摸索或者讨论。
    这个主题是我自己开发的。下面一并会给出源码。

    这里把it-tools部署到本地了。

    里面很多实用的工具,源地址:https://github.com/CorentinTh/it-tools

    更多功能后期发现实用的再整合。

  • 获取代码

    html 代码: https://github.com/xyz349925756/search_index
    epub阅读器: https://github.com/xyz349925756/neat-reader
    目录浏览:https://github.com/xyz349925756/nginx_autoindex

  • 使用
    将上面源码下载好之后放到自己喜欢的位置在 nginx .conf 里面配置
    html
    [Shell] 纯文本查看 复制代码

    server {
    listen 80;
    server_name localhost;
    location / {
    root E:\\book; # 输入路径 windows 使用 \\
    index index.html index.htm;
    }
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root html;
    }
    }

    epub 阅读器:
    [Bash shell] 纯文本查看 复制代码

    server {
    listen 808;
    server_name localhost;
    location / {
    root E:\\reades;
    index index.html index.htm;
    }

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root html;
    }
    }

    目录浏览:
    [Bash shell] 纯文本查看 复制代码

    server {
    listen 810;
    server_name localhost;

    charset utf-8;

    location / {
    root F:\\ISO\\.theme\\;
    index index.html;
    }

    location /json/ {
    alias F:\\ISO\\;
    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;
    }
    }

  • 常见问题
    如果发现搭建的web访问有乱码 。在 nginx.conf 对应的 server 加上 charset utf-8;
    需要多少服务只需要修改一下上面配置的端口号既可以。

    nginx 操作命令:

    nginx 目录添加到系统环境变量中 变量名:NGINX_PATH path: %NGINX_PATH%

    nginx 设置开机自启即可。

其他截图
我的文库预览

直接在浏览器中打开pdf文件。

我的Windows 环境下的 vscode

正文完
 0
116博客
版权声明:本篇文章由 116博客 于2025-02-06发表,共计2692字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)
验证码