我希望使用nginx来提供pdf.js,但到目前为止我遇到了这个例子。所以,我做了以下几点:
git clone git://github.com/mozilla/pdf.js.git /some/location/pdfjs
cd /some/location/pdfjs
..现在,我设置了我的nginx配置文件:
server {
listen 8181 default_server;
listen [::]:8181 default_server ipv6only=on;
# Make site accessible from http://localhost/
server_name localhost;
root /some/location/pdfjs/web;
index viewer.html;
access_log /some/location/access.log;
error_log /some/location/error.log;
location / {
}
}
当我现在运行nginx时,我没有显示PDF。我确实看到了pdf.js外部画布 - 只是没有提供PDF文件。
当我查看错误消息时,我看到:
2014/12/10 16:28:32 [error] 15549#0: *1 open() "/some/location/pdfjs/web/external/webL10n/l10n.js" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /external/webL10n/l10n.js HTTP/1.1", host: "127.0.0.1:8181", referrer: "http://127.0.0.1:8181/"
2014/12/10 16:28:32 [error] 15549#0: *2 open() "/some/location/pdfjs/web/src/shared/util.js" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /src/shared/util.js HTTP/1.1", host: "127.0.0.1:8181", referrer: "http://127.0.0.1:8181/"
2014/12/10 16:28:32 [error] 15549#0: *3 open() "/some/location/pdfjs/web/src/display/api.js" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /src/display/api.js HTTP/1.1", host: "127.0.0.1:8181", referrer: "http://127.0.0.1:8181/"
2014/12/10 16:28:32 [error] 15549#0: *4 open() "/some/location/pdfjs/web/src/display/metadata.js" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /src/display/metadata.js HTTP/1.1", host: "127.0.0.1:8181", referrer: "http://127.0.0.1:8181/"
2014/12/10 16:28:32 [error] 15549#0: *5 open() "/some/location/pdfjs/web/src/display/canvas.js" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /src/display/canvas.js HTTP/1.1", host: "127.0.0.1:8181", referrer: "http://127.0.0.1:8181/"
2014/12/10 16:28:32 [error] 15549#0: *6 open() "/some/location/pdfjs/web/src/display/webgl.js" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /src/display/webgl.js HTTP/1.1", host: "127.0.0.1:8181", referrer: "http://127.0.0.1:8181/"
2014/12/10 16:28:32 [error] 15549#0: *1 open() "/some/location/pdfjs/web/src/display/pattern_helper.js" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /src/display/pattern_helper.js HTTP/1.1", host: "127.0.0.1:8181", referrer: "http://127.0.0.1:8181/"
2014/12/10 16:28:32 [error] 15549#0: *2 open() "/some/location/pdfjs/web/src/display/font_loader.js" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /src/display/font_loader.js HTTP/1.1", host: "127.0.0.1:8181", referrer: "http://127.0.0.1:8181/"
2014/12/10 16:28:32 [error] 15549#0: *3 open() "/some/location/pdfjs/web/src/display/annotation_helper.js" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /src/display/annotation_helper.js HTTP/1.1", host: "127.0.0.1:8181", referrer: "http://127.0.0.1:8181/"
不确定这是否与提供实际PDF文件有关 - 会很感激任何解决此问题的建议。