作者归档:John

在Centos+Apache+Mysql环境下搭建私有NextCloud云盘+office文件在线协作

遇到个项目需要用到office协作,找了一圈nc比较合适,就开工了

环境:httpd 2.4.5 and later

php7 or later

安装mod_proxy

yum -y install mod_proxy_uwsgi mod_proxy_html

安装docker

yum -y install docker

参考:https://nextcloud.com/collaboraonline/

开始用docker安装collaboraonline,

docker pull collabora/code

这里遇到报错:Using default tag: latest
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

结果是docker服务没启动,跑起来:service docker start

再pull,成功

最后会得到:Status: Downloaded newer image for docker.io/collabora/code:latest

接下来,用你喜欢的方式,创建反向代理,conf文件内容如下:

<VirtualHost *:443>
#ServerName改成collabora服务实际运行的域名,一般和nextcloud不同
ServerName yourfiles.yourdomain.com:443

# SSL configuration, you may want to take the easy route instead and use Lets Encrypt!
SSLEngine on
#签名证书位置
SSLCertificateFile /path/to/signed_certificate
#中间证书位置
SSLCertificateChainFile /path/to/intermediate_certificate
#私钥
SSLCertificateKeyFile /path/to/private/key
SSLProtocol             all -SSLv2 -SSLv3
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
SSLHonorCipherOrder     on

# Encoded slashes need to be allowed
AllowEncodedSlashes NoDecode

# Container uses a unique non-signed certificate
SSLProxyEngine On
SSLProxyVerify None
#下面这2行如果引起报错 ,可以注释掉,测过不影响,因为前面已经禁用SSLProxyVerify,不知道为什么还要画蛇添足
SSLProxyCheckPeerCN Off
SSLProxyCheckPeerName Off

# keep the host
ProxyPreserveHost On

# static html, js, images, etc. served from loolwsd
# loleaflet is the client part of LibreOffice Online
ProxyPass           /loleaflet https://127.0.0.1:9980/loleaflet retry=0
ProxyPassReverse    /loleaflet https://127.0.0.1:9980/loleaflet

# WOPI discovery URL
ProxyPass           /hosting/discovery https://127.0.0.1:9980/hosting/discovery retry=0
ProxyPassReverse    /hosting/discovery https://127.0.0.1:9980/hosting/discovery

# Main websocket
ProxyPassMatch "/lool/(.*)/ws$" wss://127.0.0.1:9980/lool/$1/ws nocanon

# Admin Console websocket
ProxyPass   /lool/adminws wss://127.0.0.1:9980/lool/adminws

# Download as, Fullscreen presentation and Image upload operations
ProxyPass           /lool https://127.0.0.1:9980/lool
ProxyPassReverse    /lool https://127.0.0.1:9980/lool
</VirtualHost>

然后,就可以把docker跑起来了,先给docker加上开机启动

ckhconfig docker on

再把容器跑起来:

docker run -t -d -p 127.0.0.1:9980:9980 -e ‘domain=nextcloud\\.yourdomain\\.com’ -e “username=username” -e “password=password” –restart always –cap-add MKNOD collabora/code

 

这里的domain,是nextcloud运行的domain,需要用\\转义.,-p后面绑定在127.0.0.1是为了安全,因为最后是用反向代理对nc使用的,测试期间可以不加ip,就绑定在所有IP了

username和password是指定管理后台的用户名和密码,之前没有指定走了不少弯路,虽然这个后台在正常使用后不会再被用到,配置过程中也其实是不需要用的。

运行后会得到一个容器id,然后netstat看一下

netstat -an|grep 9980

有listening,就可以下一步了

先打开后台,看下有没有什么问题https://yourfiles.yourdomain.com/loleaflet/dist/admin/admin.html

如果登陆后有404,或者任何错误,可能是Apache版本不够高,不支持websock反向代理,自己换Apache吧,最低版本要求是2.4.5或者换nginx

nextcloud的安装就非常简单了,wget到服务器,unzip解包,按流程安装,完

接下来,在应用>office&text中启用Collabora Online

然后到设置》在线协作中,填入之前配置的Collabora Online地址,完工

 

在centos7上yum安装php7.1

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

yum -y install php71w-cli php71w-devel php71w-fpm php71w-gd php71w-mbstring php71w-mcrypt php71w-mysql php71w-opcache php71w-pdo php71w-pecl-imagick-devel php71w-pecl-memcached php71w-pgsql php71w-xmlrpc php71w-xml

 

坐等,完事

windows10专业版控制面板没有bitlocker

惆怅了很久,反复确认了版本是pro,也尝试了搜索,metro能搜到bitlocker但无法打开,控制面板直接搜索搜不到bitlocker,右键盘也没有bitlocker,找了一圈,答案很简单:启动shell hardware detection服务。

不明觉厉,之前任何一个版本禁用都毫无影响

副作用:驱动器个性化图标都显示出来了

wordpress无法编辑新建文章和页面 显示空页面

新建文章、页面、编辑、删除都直接500+空页面

最开始怀疑是数据库,修复了下不行,然后怀疑是模板,切到官方默认并升级到最新,还是不行

最后有人提到plugin,全部禁用,搞定,懒得去找是哪个插件惹祸了,直接不用了