新聞中心
介紹
OwnCloud 9.1.4是一種用于文件共享和數(shù)據(jù)同步的開(kāi)源軟件,在企業(yè)部門非常有用,你只需在服務(wù)器上安裝好 ownCloud,即可通過(guò)網(wǎng)絡(luò)訪問(wèn)和使用屬于你自己的私有云了。

成都創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的冀州網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!
安裝 Nginx 和 php
首先,安裝Nginx。 這個(gè)Web服務(wù)器在EPEL存儲(chǔ)庫(kù)中可用,所以只需添加它:
# yum install epel-release
接著:
# yum install nginx
接下來(lái),使用webtatic存儲(chǔ)庫(kù)安裝PHP-FPM(FastCGI Process Manager),并添加以下命令:
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
現(xiàn)在可以使用ownCloud所需的其他軟件包來(lái)安裝PHP:
# yum install php70w-fpm php70w-cli php70w-json php70w-mcrypt php70w-pear php70w-MySQL php70w-xml php70w-gd php70w-mbstring php70w-pdo
配置 Nginx的PHP-FPM
通過(guò)編輯php7-fpm配置文件完成PHP-FPM配置:
# $EDITOR /etc/php-fpm.d/www.conf
搜索包含“user”和“group”的那一行,并更改為:
user = nginx group = nginx
向下滾動(dòng),尋找“l(fā)isten”行,并將內(nèi)容更改為:
listen = 127.0.0.1:9000
接下來(lái),取消注釋以下有關(guān)環(huán)境變量的行:
env[HOSTNAME] = $HOSTNAME env[PATH] = /usr/local/bin:/usr/bin:/bin env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp
保存并退出。
現(xiàn)在,現(xiàn)在是使用以下命令在/var/lib /中創(chuàng)建一個(gè)新文件夾的時(shí)候了:
# mkdir -p /var/lib/php/session
將其所有者更改為nginx用戶:
# chown nginx:nginx -R /var/lib/php/session/
啟動(dòng)nginx和PHP-FPM:
# sudo systemctl start php-fpm # sudo systemctl start nginx
添加到啟動(dòng)時(shí)啟動(dòng)(作為服務(wù)器的日常使用所需):
# systemctl enable nginx # systemctl enable php-fpm
安裝 MariaDB
MariaDB在CentOS存儲(chǔ)庫(kù)中可用,因此請(qǐng)安裝:
# yum install mariadb mariadb-server
配置MariaDB root密碼:
# mysql_secure_installation
在此過(guò)程中,需要回答以下問(wèn)題:
Set root password? [Y/n] New password: Re-enter new password: Remove anonymous users? [Y/n] Disallow root login remotely? [Y/n] Remove test database and access to it? [Y/n] Reload privilege tables now? [Y/n]
登錄到MariaDB shell,為ownCloud創(chuàng)建一個(gè)新的數(shù)據(jù)庫(kù)和用戶。 在此示例中,my_owncloud_db是數(shù)據(jù)庫(kù)名稱,ocuser是其用戶。 密碼是:my_strong_password。
所以執(zhí)行命令:
# mysql -u root -p
接著:
mysql> CREATE DATABASE my_owncloud_db; mysql> CREATE USER ocuser@localhost IDENTIFIED BY 'my_strong_password'; mysql> GRANT ALL PRIVILEGES ON my_owncloud_db.* to ocuser@localhost IDENTIFIED BY 'my_strong_passowrd'; mysql> FLUSH PRIVILEGES;
生成SSL證書(shū)
如果不存在,請(qǐng)為SSL文件創(chuàng)建一個(gè)新目錄:
# mkdir -p /etc/nginx/cert/
接下來(lái),生成一個(gè)新的SSL證書(shū)文件:
# openssl req -new -x509 -days 365 -nodes -out /etc/nginx/cert/owncloud.crt -keyout /etc/nginx/cert/owncloud.key
使用以下命令更改權(quán)限:
# chmod 600 /etc/nginx/cert/*
現(xiàn)在 ownCloud
現(xiàn)在 ownCloud:
# wget https://download.owncloud.org/community/owncloud-9.1.4.zip
提取存檔并將其移動(dòng)到/usr/share/nginx/html/:
# unzip owncloud-9.1.2.zip # mv owncloud/ /usr/share/nginx/html/
轉(zhuǎn)到Nginx根目錄; 在那里,為ownCloud創(chuàng)建一個(gè)新的數(shù)據(jù)目錄:
# cd /usr/share/nginx/html/ # mkdir -p owncloud/data/
在Nginx中配置虛擬主機(jī)
使用以下命令創(chuàng)建虛擬主機(jī)配置文件:
# $EDITOR /etc/nginx/conf.d/owncloud.conf
將以下文本粘貼到文件中:
upstream php-handler {
server 127.0.0.1:9000;
#server unix:/var/run/php5-fpm.sock;
}
server {
listen 80;
server_name data.owncloud.co;
# enforce https
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name storage.example.com;
ssl_certificate /etc/nginx/cert/owncloud.crt;
ssl_certificate_key /etc/nginx/cert/owncloud.key;
# Add headers to serve security related headers
# Before enabling Strict-Transport-Security headers please read into this topic first.
add_header Strict-Transport-Security "max-age=15552000; includeSubDomains";
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
# Path to the root of your installation
root /usr/share/nginx/html/owncloud/;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# The following 2 rules are only needed for the user_webfinger app.
# Uncomment it if you're planning to use this app.
#rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
#rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
location = /.well-known/carddav {
return 301 $scheme://$host/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $scheme://$host/remote.php/dav;
}
location /.well-known/acme-challenge { }
# set max upload size
client_max_body_size 512M;
fastcgi_buffers 64 4K;
# Disable gzip to avoid the removal of the ETag header
gzip off;
# Uncomment if your server is build with the ngx_pagespeed module
# This module is currently not supported.
#pagespeed off;
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;
location / {
rewrite ^ /index.php$uri;
}
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
return 404;
}
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
return 404;
}
location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ ^/(?:updater|ocs-provider)(?:$|/) {
try_files $uri $uri/ =404;
index index.php;
}
# Adding the cache control header for js and css files
# Make sure it is BELOW the PHP block
location ~* \.(?:css|js)$ {
try_files $uri /index.php$uri$is_args$args;
add_header Cache-Control "public, max-age=7200";
# Add headers to serve security related headers (It is intended to have those duplicated to the ones above)
# Before enabling Strict-Transport-Security headers please read into this topic first.
#add_header Strict-Transport-Security "max-age=15552000; includeSubDomains";
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
# Optional: Don't log access to assets
access_log off;
}
location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
try_files $uri /index.php$uri$is_args$args;
# Optional: Don't log access to other assets
access_log off;
}
}
保存并退出。 接下來(lái),測(cè)試Nginx:
# nginx -t
This should display a “Syntax OK” message.
重啟Nginx:
# systemctl restart nginx
總結(jié)
服務(wù)器端配置完成。最后一件事是使用Web瀏覽器轉(zhuǎn)到您自己的Cloud服務(wù)器URL(本示例中為storage.example.com),并使用圖形前端完成配置。通過(guò)創(chuàng)建新的管理員帳戶,并輸入在前面的步驟中創(chuàng)建的數(shù)據(jù)庫(kù)憑據(jù)來(lái)執(zhí)行此操作。您的云端存儲(chǔ)服務(wù)現(xiàn)在已準(zhǔn)備好用于日常使用!
本文永久更新鏈接地址:http://www.linuxidc.com/Linux/2017-07/145698.htm
分享名稱:CentOS7上安裝搭建ownCloud9.1.4私有云
文章鏈接:http://m.5511xx.com/article/coioppo.html
其他資訊
- 輕松實(shí)現(xiàn)服務(wù)器自動(dòng)重啟:詳解設(shè)置方法(服務(wù)器如何設(shè)置自動(dòng)從啟)
- 個(gè)體戶營(yíng)業(yè)執(zhí)照辦理網(wǎng)站登錄,辦理個(gè)體戶營(yíng)業(yè)執(zhí)照需要哪些資料
- HTTP安全策略:避免通過(guò)GET參數(shù)發(fā)送敏感數(shù)據(jù)
- 如何通過(guò)SQL注入查詢數(shù)據(jù)庫(kù)名? (sql注入查詢數(shù)據(jù)庫(kù)名)
- PolarDB的serverless數(shù)據(jù)庫(kù)如何公網(wǎng)訪問(wèn)?


咨詢
建站咨詢
