centos7 nextcloud 整合 onlyoffice

张映 发表于 2019-09-04

分类目录: 云计算, 服务器相关

标签:, , ,

nextcloud安装配置,请参考: centos7 nextcloud nginx php mariadb 安装配置,本文的重点是onlyoffice安装,以及与nextcloud的整合。

1,onlyoffice硬件要求

  1. CPU dual core 2 GHz or better  
  2. RAM 2 GB or more  
  3. HDD at least 40 GB of free space  
  4. Additional requirements at least 4 GB of swap  
  5. OS RHEL 7 or CentOS 7  
  6. Additional requirements  
  7.   PostgreSQL: version 9.1 or later  
  8.   NGINX: version 1.3.13 or later  
  9.   Node.js: version 8.12.0  
  10.   Redis  
  11.   RabbitMQ  

要求挺高,要求挺高,要求挺高

2,安装依赖

  1. # yum install gcc-c++ automake autoconf gcc make  

3,安装epel源

  1. # yum install epel-release  

4,安装nodejs8源

  1. # curl -sL https://rpm.nodesource.com/setup_8.x | sudo bash -  

5,安装nginx,配置nginx.conf

  1. # yum install nginx  
  2. # vim /etc/nginx/nginx.conf  
  3.   
  4. user nginx;  
  5. worker_processes auto;  
  6. error_log /var/log/nginx/error.log;  
  7. pid /run/nginx.pid;  
  8.   
  9. # Load dynamic modules. See /usr/share/nginx/README.dynamic.  
  10. include /usr/share/nginx/modules/*.conf;  
  11.   
  12. events {  
  13.     worker_connections 1024;  
  14. }  
  15.   
  16. http {  
  17.     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '  
  18.                       '$status $body_bytes_sent "$http_referer" '  
  19.                       '"$http_user_agent" "$http_x_forwarded_for"';  
  20.   
  21.     access_log  /var/log/nginx/access.log  main;  
  22.     sendfile            on;  
  23.     keepalive_timeout   65;  
  24.     include             /etc/nginx/mime.types;  
  25.     default_type        application/octet-stream;  
  26.     include /etc/nginx/conf.d/*.conf;  
  27.   
  28. }  

6,安装启动redis,rabbitmq-server

  1. # yum install redis rabbitmq-server  
  2.   
  3. # systemctl start redis  
  4. # systemctl enable redis  
  5.   
  6. # systemctl start rabbitmq-server  
  7. # systemctl enable rabbitmq-server  

7,安装postgresql

  1. # yum install postgresql postgresql-server  
  2.   
  3. # service postgresql initdb  
  4. # chkconfig postgresql on  
  5.   
  6. # vim /var/lib/pgsql/data/pg_hba.conf  
  7.   
  8. host all all 127.0.0.1/32 trust //ident换成trust  
  9. host all all ::1/128 trust //ident换成trust  
  10.   
  11. # systemctl restart postgresql  

8,创建数据库

  1. # cd /tmp //重要  
  2. # sudo -u postgres psql -c "CREATE DATABASE onlyoffice;"  
  3. # sudo -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"  
  4. # sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"  

9,安装onlyoffice源

  1. # yum install https://download.onlyoffice.com/repo/centos/main/noarch/onlyoffice-repo.noarch.rpm  
  2. # cat /etc/yum.repos.d/onlyoffice.repo   //yum完,产生源文件  
  3. [onlyoffice]  
  4. name=onlyoffice repo  
  5. baseurl=http://download.onlyoffice.com/repo/centos/main/noarch/  
  6. gpgcheck=1  
  7. enabled=1  

10,安装配置onlyoffice

  1. # yum install onlyoffice-documentserver  
  2.   
  3. # bash documentserver-configure.sh  
  4. Configuring PostgreSQL access...  
  5. Host: localhost  
  6. Database name: onlyoffice  
  7. User: onlyoffice  
  8. Password:onlyoffice  
  9. Trying to establish PostgreSQL connection... OK  
  10. Installing PostgreSQL database... OK  
  11. Configuring redis access...  
  12. Host: localhost  
  13.   
  14. Trying to establish redis connection... OK  
  15. Configuring RabbitMQ access...  
  16. Host: localhost  
  17. User: guest  
  18. Password:guest  
  19. Trying to establish RabbitMQ connection... OK  
  20. Restarting services... OK  
  21.   
  22. # systemctl start supervisord  
  23. # systemctl enable supervisord  

11,配置nginx https

  1. # cd /etc/onlyoffice/documentserver/nginx  
  2. # cp ds-ssl.conf.tmpl ds-ssl.conf  
  3. # ln -s /etc/onlyoffice/documentserver/nginx/ds-ssl.conf /etc/nginx/conf.d/  
  4. # cat /etc/nginx/conf.d/ds-ssl.conf  //要软连接  
  5. include /etc/nginx/includes/http-common.conf;  
  6. ## Normal HTTP host  
  7. server {  
  8.  listen 80;  
  9.  server_name onlineoffice.netjoy.com;  
  10.  server_tokens off;  
  11.   
  12.  ## Redirects all traffic to the HTTPS host  
  13.  root /nowhere; ## root doesn't have to be a valid path since we are redirecting  
  14.  rewrite ^ https://$host$request_uri? permanent;  
  15. }  
  16.   
  17. #HTTP host for internal services  
  18. server {  
  19.  listen 127.0.0.1:80;  
  20.  listen [::1]:80;  
  21.  server_name localhost;  
  22.  server_tokens off;  
  23.   
  24.  include /etc/nginx/includes/ds-common.conf;  
  25.  include /etc/nginx/includes/ds-docservice.conf;  
  26. }  
  27.   
  28. ## HTTPS host  
  29. server {  
  30.  listen 443;  
  31.  server_name onlineoffice.netjoy.com;  
  32.  server_tokens off;  
  33.  root /usr/share/nginx/html;  
  34.   
  35.  ## Strong SSL Security  
  36.  ## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html  
  37.  ssl on;  
  38.  ssl_certificate /etc/nginx/cert/office.pem;  
  39.  ssl_certificate_key /etc/nginx/cert/office.key;  
  40.  ssl_verify_client off;  
  41.   
  42.  ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";  
  43.   
  44.  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;  
  45.  ssl_session_cache builtin:1000 shared:SSL:10m;  
  46.   
  47.  ssl_prefer_server_ciphers on;  
  48.   
  49.  add_header Strict-Transport-Security max-age=31536000;  
  50.  # add_header X-Frame-Options SAMEORIGIN;  
  51.  add_header X-Content-Type-Options nosniff;  
  52.   
  53.  ## [Optional] If your certficate has OCSP, enable OCSP stapling to reduce the overhead and latency of running SSL.  
  54.  ## Replace with your ssl_trusted_certificate. For more info see:  
  55.  ## - https://medium.com/devops-programming/4445f4862461  
  56.  ## - https://www.ruby-forum.com/topic/4419319  
  57.  ## - https://www.digitalocean.com/community/tutorials/how-to-configure-ocsp-stapling-on-apache-and-nginx  
  58.  # ssl_stapling on;  
  59.  # ssl_stapling_verify on;  
  60.  # ssl_trusted_certificate /etc/nginx/ssl/stapling.trusted.crt;  
  61.  # resolver 208.67.222.222 208.67.222.220 valid=300s; # Can change to your DNS resolver if desired  
  62.  # resolver_timeout 10s;  
  63.   
  64.  ## [Optional] Generate a stronger DHE parameter:  
  65.  ## cd /etc/ssl/certs  
  66.  ## sudo openssl dhparam -out dhparam.pem 4096  
  67.  ##  
  68.  # ssl_dhparam /etc/ssl/certs/dhparam.pem;  
  69.   
  70.  include /etc/nginx/includes/ds-*.conf;  
  71.   
  72. }  
  73.   
  74. # systemctl restart nginx  
onlyoffice服务端配置成功

onlyoffice服务端配置成功

12,下载nextcloud-onlyoffice插件

  1. # cd nextcloud路径/apps/  
  2. # git clone https://github.com/ONLYOFFICE/onlyoffice-owncloud.git onlyoffice  

13,启用插件

启用onlyoffice 插件

启用onlyoffice 插件

设置onlyoffice服务端地址

设置onlyoffice服务端地址

onlyoffice可编辑的文件后缀

onlyoffice可编辑的文件后缀

在线创建流程图,office文件

在线创建流程图,office文件

在这里推荐二个插件:

Draw.io(流程图插件)和Mind Map(思维导图插件)



转载请注明
作者:海底苍鹰
地址:http://blog.51yip.com/server/2174.html

3 条评论

  1. kingstrong 留言

    我这边在同一台电脑上弄集成onlyoffice,到11步配置nginx https完 重启nginx 提示错误 不能启动nginx 错误是
    :nginx: [emerg] duplicate upstream "docservice" in /etc/nginx/includes/http-common.conf:1
    : nginx.service: control process exited, code=exited status=1
    : Failed to start nginx - high performance web server.
    : Unit nginx.service entered failed state.
    : nginx.service failed.求帮助 qq421381118

  2. startfromnow 留言

    到11步配置nginx https完 重启nginx 提示错误 不能启动nginx 错误是
    Job for nginx.service failed because the control process exited with error code.
    See "systemctl status nginx.service" and "journalctl -xe" for details.
    . nginx.service - The nginx HTTP and reverse proxy server
    Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
    Active: failed (Result: exit-code) since Sun 2020-04-19 22:57:54 EDT; 1min 27s ago
    Process: 10913 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
    Process: 10912 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

    4月 19 22:57:54 localhost.localdomain systemd[1]: Starting The nginx HTTP and reverse proxy server...
    4月 19 22:57:54 localhost.localdomain nginx[10913]: nginx: [emerg] directive "ssl_certificate" is not terminated by ";" in /etc/nginx/conf.d/ds-ssl.conf>
    4月 19 22:57:54 localhost.localdomain nginx[10913]: nginx: configuration file /etc/nginx/nginx.conf test failed
    4月 19 22:57:54 localhost.localdomain systemd[1]: nginx.service: Control process exited, code=exited status=1
    4月 19 22:57:54 localhost.localdomain systemd[1]: nginx.service: Failed with result 'exit-code'.
    4月 19 22:57:54 localhost.localdomain systemd[1]: Failed to start The nginx HTTP and reverse proxy server.

  3. startfromnow 留言

    问题应该在这,ssl_certificate /etc/nginx/cert/office.pem;我们目录 下没有此文件,怎么处理?