nginx php7 owncloud,KodExplorer和OwnCloud在Centos7.x-LNMP安装教程

以下教程适用于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\") 测试只返回一个空值。”这个我没能解决,也没发现有什么影响,有大神知道的话可以救救我,谢谢

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值