gethexon / hexon

Let's hexo online.
https://hexon-demo.yujianghao.cn/#/
GNU General Public License v3.0
106 stars 22 forks source link

`https://<ip:port>/admin` 子路径下同端口访问 #13

Closed appotry closed 1 year ago

appotry commented 2 years ago

开两个端口不够优雅。 ip/admin这样访问,反向代理时一个域名就可以搞定

appotry commented 2 years ago

另外整个npm打包的话,用起来更方便

YuJianghao commented 2 years ago

目前架构上有难度,基本相当于重写了

appotry commented 2 years ago

nginx有端口转发,访问链接rewrite方法,npm包里面有没有类似的工具来实现了? @YuJianghao

YuJianghao commented 2 years ago

nginx有端口转发,访问链接rewrite方法,npm包里面有没有类似的工具来实现了? @YuJianghao

没看懂你想找的是 npm 的哪种工具。「nginx有端口转发,访问链接rewrite方法」具体指什么?

YuJianghao commented 2 years ago

另外还想问下,为什么要使用「hexo 本地预览」当做博客服务,而不是生成静态文件然后部署到其他平台?

appotry commented 2 years ago

本地反向代理端口访问博客的作用是,https支持pwa,tls等特性,在上传之前本地预览验证一下。测试没有问题再正式上传到云端

nginx 访问链接rewrite功能指的是 好比 访问 /admin , nginx把这种链接转发到/myadmin 这样类似的链接替换,转发到其它非80,443端口,等。可以实现很多功能

winwin2011 @.***> 于2022年6月23日周四 12:47写道:

另外还想问下,为什么要使用「hexo 本地预览」当做博客服务,而不是生成静态文件然后部署到其他平台?

— Reply to this email directly, view it on GitHub https://github.com/gethexon/hexon/issues/13#issuecomment-1163923605, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI5MJ3LE2U57IA3Y4OHSMLVQPT7FANCNFSM5XTVCVKA . You are receiving this because you authored the thread.Message ID: @.***>

appotry commented 2 years ago

本地反向代理测试各种插件,文章编排格式,文章修订等等。在正式上传之前本地预览一下,防止错误内容上传到云端

winwin2011 @.***> 于2022年6月23日周四 12:47写道:

另外还想问下,为什么要使用「hexo 本地预览」当做博客服务,而不是生成静态文件然后部署到其他平台?

— Reply to this email directly, view it on GitHub https://github.com/gethexon/hexon/issues/13#issuecomment-1163923605, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI5MJ3LE2U57IA3Y4OHSMLVQPT7FANCNFSM5XTVCVKA . You are receiving this because you authored the thread.Message ID: @.***>

YuJianghao commented 2 years ago

测试插件和预览更改看起来是个很好的需求。但是有个问题,这两个是如何做到身份验证的。如果没有身份验证,那预览端口永远开着么?安全问题是如何解决的?

YuJianghao commented 2 years ago

nginx有端口转发,访问链接rewrite方法,npm包里面有没有类似的工具来实现了? @YuJianghao

实现难度不在于 rewrite 而是在于后端数据问题。现在的后端是自己启动了单独的 hexo,如果想要公用端口,现在能想到的是作为 hexo 插件接入 hexo。而后者需要大量重写代码。

appotry commented 2 years ago

https://github.com/jaredly/hexo-admin 参考一下这个的实现?

winwin2011 @.***> 于2022年6月24日周五 12:14写道:

nginx有端口转发,访问链接rewrite方法,npm包里面有没有类似的工具来实现了? @YuJianghao https://github.com/YuJianghao

实现难度不在于 rewrite 而是在于后端数据问题。现在的后端是自己启动了单独的 hexo,如果想要公用端口,现在能想到的是作为 hexo 插件接入 hexo。而后者需要大量重写代码。

— Reply to this email directly, view it on GitHub https://github.com/gethexon/hexon/issues/13#issuecomment-1165174516, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI5MJ65CTBIXQXGJRHH3OLVQUYZ3ANCNFSM5XTVCVKA . You are receiving this because you authored the thread.Message ID: @.***>

YuJianghao commented 2 years ago

这个了解过。目前还是面临两个问题:

appotry commented 2 years ago

关于第一个,个人解决方法是反向代理的是否使用nginx的认证访问。本地验证时,直接使用端口也没关系,放到云端部署,就部署到nginx后面,使用nginx的认证

个人做了一个nginx docker https://github.com/appotry/nginx-purge-docker 参考配置


        # To add basic authentication to v2 use auth_basic setting.
        #这个是提示信息
        auth_basic "Please input password";
        #存放密码文件的路径
        auth_basic_user_file /etc/nginx/conf.d/cron.htpasswd;

winwin2011 @.***> 于2022年6月25日周六 15:20写道:

这个了解过。目前还是面临两个问题:

  • 预览端口如何保证安全,hexo 自带的预览是没有权限控制的,所有人都可以看的到。
  • 如果迁移到 hexo 插件,有很大的工作量

— Reply to this email directly, view it on GitHub https://github.com/gethexon/hexon/issues/13#issuecomment-1166212711, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI5MJ42C2VIS57Y5IELGODVQ2XMPANCNFSM5XTVCVKA . You are receiving this because you authored the thread.Message ID: @.***>

appotry commented 2 years ago

另外,这个插件实现了访问认证 https://github.com/jaredly/hexo-admin ,或者参考这个的认证实现?

winwin2011 @.***> 于2022年6月25日周六 15:20写道:

这个了解过。目前还是面临两个问题:

  • 预览端口如何保证安全,hexo 自带的预览是没有权限控制的,所有人都可以看的到。
  • 如果迁移到 hexo 插件,有很大的工作量

— Reply to this email directly, view it on GitHub https://github.com/gethexon/hexon/issues/13#issuecomment-1166212711, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI5MJ42C2VIS57Y5IELGODVQ2XMPANCNFSM5XTVCVKA . You are receiving this because you authored the thread.Message ID: @.***>

YuJianghao commented 2 years ago

感觉 nginx 的方案还是满意。倾向于想办法让这些验证由 hexo 提供。

YuJianghao commented 1 year ago

暂时关闭了,如果有更新随时开