2019-06-12-build-docs-gl

layouttitlesubtitledateauthortags
post
docs.gl 搭建过程
日有所得
2019-06-12
cj
opengl docs.gl nginx

docs.gl 搭建过程

最近在学习 OpenGL,如 docs.gl 作者所言:

The actual documentation website provided by Khronos is in frames and poorly formatted, difficult to navigate and search.

官方文档 确实难看啊,幸好有 docs.gl 救场。

  1. cd /var/www/data && sudo git clone https://github.com/BSVino/docs.gl
  2. sudo python build.py --full,生成 htdocs 文件夹存放了所有网站内容。由于生成的网页都不带 html 后缀名,直接使用 ngxin 站点,打开链接无法浏览,会下载文件。。因此使用 ngxin 代理到 docs.gl 提供的 server.py 简单 python 网站服务。
  3. 使用 nginx 代理,配置如下:
    server {
        listen 80;
        server_name gl.doc.********.com;
    
        location / {
            proxy_pass http://localhost:8001;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    
    }
  4. 尝试运行:cd htdocs && sudo python ../server.py,打开浏览器可以看到内容,但一些链接没法点,也不能搜索。看 python 输出,提示:
    127.0.0.1 - - [12/Jun/2019 14:59:28] "GET /htdocs/jquery-bonsai/jquery.bonsai.js HTTP/1.0" 404 -
    127.0.0.1 - - [12/Jun/2019 14:59:28] code 404, message File not found
    127.0.0.1 - - [12/Jun/2019 14:59:28] "GET /htdocs/jquery-bonsai/jquery.bonsai.css HTTP/1.0" 404 -
    127.0.0.1 - - [12/Jun/2019 14:59:28] code 404, message File not found
    127.0.0.1 - - [12/Jun/2019 14:59:28] "GET /htdocs/jquery-cookie/jquery.cookie.js HTTP/1.0" 404 -
    127.0.0.1 - - [12/Jun/2019 14:59:28] code 404, message File not found
    
    一堆404。。。手动下载吧:
    sudo rm -rf jquery-bonsai
    sudo git clone https://github.com/aexmachina/jquery-bonsai jquery-bonsai
    cd jquery-cookie
    sudo wget https://github.com/carhartl/jquery-cookie/blob/master/src/jquery.cookie.js?raw=true -O jquery.cookie.js
    再次刷新网页,可以正常浏览、搜索了。
  5. 一直开着 putty 也不是事,加个 supervisor 配置 gldocs.conf
    [program:gldoc]
    process_name=%(program_name)s
    directory=/var/www/docs.gl/htdocs
    command=python /var/www/docs.gl/server.py
    autostart=true
    autorestart=true
    user=www-data
    redirect_strerr=true
    stdout_logfile=/var/www/docs.gl/server.log
    
    sudo supervisorctl update 搞定。
  6. server.log 有问题。虽然生成了文件,但是是 root 用户的,而且大小一直是0。手动 chownwww-data 用户,依然如故。猜测是用户权限或 python 的标准输出有问题?今天很困,抽空研究研究。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值