Skip to content

支持任意URL #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Gcaufy opened this issue Dec 20, 2016 · 12 comments
Closed

支持任意URL #31

Gcaufy opened this issue Dec 20, 2016 · 12 comments

Comments

@Gcaufy
Copy link

Gcaufy commented Dec 20, 2016

能否支持任意URL,这样我就可以放在我自己的服务器上

比如:

docsify('https://raw.githubusercontent.com/myrepo/master/README.md')
@QingWei-Li
Copy link
Member

没看懂「任意 URL」指的是什么意思。如果只是想部署在自己服务器上,并不需要做任何额外的操作,如果是 nginx 只需要用下面的配置即可

server {
  listen 80;
  server_name  your.domain.com;

  location / {
    alias /path/to/dir/of/docs;
    index index.html;
  }
}

参考:

@Gcaufy
Copy link
Author

Gcaufy commented Dec 20, 2016

部署在其它服务器, 但是使用的是 github.com/myrepo/README.md
如何指定md文件,而不是默认取./docs/README.md

@QingWei-Li
Copy link
Member

现在 html 入口文件要和 md 文档文件在同个目录下才有效。不过看起来可以加一个 basePath 的选项。

@Gcaufy
Copy link
Author

Gcaufy commented Dec 20, 2016

刚看了一下代码,xhr的。那么就无法避免跨域问题。
求提供生成静态HTML的命令行,不要动态拉取README.md
如:

docsify ./docs/README.md  => html.html
docsify http://www.xxx.com/README.md  => html.html

@QingWei-Li
Copy link
Member

特色是动态生成而非编译静态文件 😂 不打算支持这个功能

@bigggge
Copy link

bigggge commented Mar 2, 2017

问下nginx配置,为什么第一种配置docs显示404,放在根目录就可以

   location /docs/ {
      root /home/docs;
      index index.html index.htm;
    }

    location / {
      root /home/docs;
      index index.html index.htm;
    }

配置

server {
        listen       80 default_server;
        listen       [::]:80 default_server;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location /api/ {
          proxy_pass http://127.0.0.1:3000/;
        }

        location /docs/ {
          root /home/docs;
          index index.html index.htm;
        }

        location / {
          root /home/docs;
          index index.html index.htm;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

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

@lxiaoxiang
Copy link

我也遇到这个问题,把文件名小写试试

@istommao
Copy link

istommao commented Jun 8, 2018

用caddy 要怎么配置,我配起来都是空白页?

@EvanLind
Copy link

EvanLind commented Sep 5, 2019

没看懂「任意 URL」指的是什么意思。如果只是想部署在自己服务器上,并不需要做任何额外的操作,如果是 nginx 只需要用下面的配置即可

server {
  listen 80;
  server_name  your.domain.com;

  location / {
    alias /path/to/dir/of/docs;
    index index.html;
  }
}

参考:

The correct vps nginx conf is:

server {
  listen 80;
  server_name  your.domain.com;

  location / {
    root /path/to/dir/of/docs;
    index index.html;
  }
}

Or you have to change your static file owner to nging conf user
https://stackoverflow.com/questions/16808813/nginx-serve-static-file-and-got-403-forbidden

@m5xhsy
Copy link

m5xhsy commented Mar 11, 2021

怎么去掉url上面那个#/啊

@QingWei-Li
Copy link
Member

怎么去掉url上面那个#/啊

https://docsify.js.org/#/configuration?id=routermode

@Subilan
Copy link

Subilan commented Feb 19, 2024

没看懂「任意 URL」指的是什么意思。如果只是想部署在自己服务器上,并不需要做任何额外的操作,如果是 nginx 只需要用下面的配置即可

server {
  listen 80;
  server_name  your.domain.com;

  location / {
    alias /path/to/dir/of/docs;
    index index.html;
  }
}

参考:

The correct vps nginx conf is:

server {
  listen 80;
  server_name  your.domain.com;

  location / {
    root /path/to/dir/of/docs;
    index index.html;
  }
}

Or you have to change your static file owner to nging conf user https://stackoverflow.com/questions/16808813/nginx-serve-static-file-and-got-403-forbidden

It's been a few years since I lastly used Docsify, and today I tried to deploy some old pages with nginx, using the configuration from the document (same as what the author mentioned in this issue), and encountered the 403 problem quite smoothly. Changing alias to root is the solution.

Thank you, my friend, you saved my day :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants