通过遵循关于如何从源安装的说明和部署,我在本地Debian中设置了CKAN2.9。
我使用NGINX、UWSGI和Supervisor运行CKAN,但是,当我试图更改运行CKAN的URL路径时,我遇到了麻烦。
请参阅在http://192.168.60.11/中运行良好的CKAN,但我希望它在 http://192.168.60.11/ckan中运行
为此,我更改了In ckan.ini ckan.site_url to ckan.site_url = http://192.168.60.11/ckan`
NGINX默认站点conf为:
location /ckan/ {
proxy_pass http://127.0.0.1:8080/;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_cache cache;
proxy_cache_bypass $cookie_auth_tkt;
proxy_no_cache $cookie_auth_tkt;
proxy_cache_valid 30m;
proxy_cache_key $host$scheme$proxy_host$request_uri;
# In emergency comment out line to force caching
# proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
}重新加载nginx.service并重新启动supervisior.service
http://192.168.60.11/ckan/把我带到了CKNA登陆页面,但不是CSS/JS/图片加载。在浏览器中加载错误,如:Loading failed for the <script> with source “http://192.168.60.11/webassets/vendor/d8ae4bed_jquery.js”.
如果我单击指向数据集的链接,就会被定向到http://192.168.60.11/dataset/,而不是http://192.168.60.11/ckan/dataset/
以及在/etc/ckan/default/uwsgi.ERR中:
2020-08-30 19:19:41,554 INFO [ckan.config.middleware.flask_app] / render time 0.114 seconds [pid: 7699|app: 0|req: 53/53] 127.0.0.1 () {42 vars in 767 bytes} [Sun Aug 30 19:19:41 2020] GET / => generated 13765 bytes in 122 msecs (HTTP/1.0 200) 3 headers in 106 bytes (1 switches on core 0)
因此,似乎CKAN缺少一些配置参数,以使它知道URL路径。有什么办法吗?谢谢
发布于 2020-09-01 08:33:40
# ckan.ini
ckan.site_url = "http://public.domain" # no path suffix here
ckan.root_path = "/prefix"# nginx config
location /prefix/ {
proxy_pass http://127.0.0.1:8080; # no path suffix here
}答案在CKAN文档中
而nginx的位置只需从/更改为/custom/path
https://stackoverflow.com/questions/63661310
复制相似问题