产品服务AMH 免费服务器主机面板SSL证书 免费SSL证书申请 担保单 免费安全、零费率交易平台编程助手免费智能写代码、翻译AMYSQL 免费MySQL管理工具

AMH 社区首页

 AMH社区 - 开放自由有价值的社区

[综合话题] KodExplorer和OwnCloud在Centos7.x-LNMP安装教程

tanjian
铁牌会员
144.43 价值分

tanjian 发表于 2017-01-05 10:53:01
以下教程适用于centos7.x,nginx-1.10,mysql-5.7,php-7.0,其他版本未测试
首先说一下KodExplorer,这个简单,建一个虚拟主机,把KodExplorer下载的包上传解压就行,README文件里有相关权限设置,可以用FTP设置,之后访问地址,按引导配置用户就行。
下面说一下OwnCloud
1.创建虚拟主机
修改/home/wwwroot/环境名/vhost/主机名.conf(可以用上面安装的KodExplorer)
一下为https设置的例子
#*******************************************start
server
{
listen 80; #listen end
server_name cloud.tanjian.net;
# enforce https
return 301 https://$server_name$request_uri;
}
#*******************************************end
server
{
listen 443 ssl;
server_name {域名}; #server_name end
index index.html index.htm index.php; #index end

root /home/wwwroot/{环境名}/domain/{域名}/web; #root end
include /home/wwwroot/{环境名}/rewrite/amh.conf; #rewrite end

#*******************************************start
ssl_certificate /home/wwwroot/{环境名}/certificate/{域名}.pem;
ssl_certificate_key /home/wwwroot/{环境名}/certificate/{域名}.key;
#*******************************************end

# Add headers to serve security related headers
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;

# 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 = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

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 2048M;
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_pass unix:/tmp/php-cgi-{环境名}-{域名}.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fcgi.conf;
fastcgi_param DOCUMENT_ROOT /home/wwwroot/{环境名}/domain/{域名}/web;
fastcgi_param SCRIPT_FILENAME /home/wwwroot/{环境名}/domain/{域名}/web$fastcgi_script_name;
#*******************************************end
fastcgi_param HTTPS on;
#*******************************************end
fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice
fastcgi_param front_controller_active true;
fastcgi_intercept_errors on;
fastcgi_request_buffering off; #Available since nginx 1.7.1;
}

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;
}

access_log off; #access_log end
error_log /dev/null; #error_log end
}

http需要把#**start到#**end中的配置删掉,并把443 ssl改为80

官方配置例子https://doc.owncloud.org/server/latest/admin_manual/installation/nginx_examples.html
,如果使用二级目录或子域名注意修改相关主机目录地址
2.重启nginx
3.在AMH后台安装ampathinfo-1.5,fileinfo-1.0并对主机启用(上面配置后ampathinfo-1.5应该已经显示开启)
4.下载ownCloud并解压到主机目录
5.使用SSH客户端按照https://doc.owncloud.org/server/latest/admin_manual/installation/installation_wizard.html#strong-perms-label设置权限或使用SSH客户端依次执行以下命令(其实都一样)
mkdir -p /home/wwwroot/{环境名}/domain/{域名}/web/data
mkdir -p /home/wwwroot/{环境名}/domain/{域名}/web/assets
mkdir -p /home/wwwroot/{环境名}/domain/{域名}/web/updater
find /home/wwwroot/{环境名}/domain/{域名}/web/ -type f -print0 | xargs -0 chmod 0640
find /home/wwwroot/{环境名}/domain/{域名}/web/ -type d -print0 | xargs -0 chmod 0750
chown -R root:www /home/wwwroot/{环境名}/domain/{域名}/web/
chown -R www:www /home/wwwroot/{环境名}/domain/{域名}/web/apps/
chown -R www:www /home/wwwroot/{环境名}/domain/{域名}/web/assets/
chown -R www:www /home/wwwroot/{环境名}/domain/{域名}/web/config/
chown -R www:www /home/wwwroot/{环境名}/domain/{域名}/web/data/
chown -R www:www /home/wwwroot/{环境名}/domain/{域名}/web/themes/
chown -R www:www /home/wwwroot/{环境名}/domain/{域名}/web/updater/
chmod +x /home/wwwroot/{环境名}/domain/{域名}/web/occ
chmod 0644 /home/wwwroot/{环境名}/domain/{域名}/web/.htaccess
chown root:www /home/wwwroot/{环境名}/domain/{域名}/web/.htaccess
chmod 0644 /home/wwwroot/{环境名}/domain/{域名}/web/data/.htaccess
chown root:www /home/wwwroot/{环境名}/domain/{域名}/web/data/.htaccess

6.访问主机域名,按配置设置用户及数据库
7.为所以为

注意!我安装完后再安全设置中显示“PHP 似乎没有设置好查询的系统环境变量。 用 getenv(\"PATH\") 测试只返回一个空值。”这个我没能解决,也没发现有什么影响,有大神知道的话可以救救我,谢谢
  点赞,加油! (18.57分)
2017-01-05 10:53:01 1

amysql
创始人
99530.81 价值分

感谢分享。相关伪静态规则建议在amrewrite中使用。
https开启可以用amssl。
  支持 (0分)  反对 (0分)
回复  2017-01-05 16:08:17 2

AMH面板 - 好用高效低占用、安全可靠极稳定

suppore
铝牌会员
203.76 价值分

个人推荐直接使用模块更加方便
  支持 (0分)  反对 (0分)
回复  2017-01-06 17:34:20 3

906842182
限制会员
-2.67 价值分

个人推荐直接使用模块更加方便
  支持 (0分)  反对 (0分)
回复  2017-01-07 10:28:35 4
 1  (总1页)
AMH社区列表
用户服务中心