部署环境
序号 |
操作系统 |
公网IP |
域名解析 |
1 |
CentOS Linux release 7.8.2003 (Core) |
47.94.. |
cloud.ponfey.com |
YUM部署Nginx
[root@web-server ~]# vi /etc/yum.repos.d/nginx.repo # 新增repo配置文件
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
[root@web-server ~]# yum clean all
[root@web-server ~]# yum makecache
[root@web-server ~]# yum install nginx -y
YUM部署MySQL
[root@web-server packages]# wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
[root@web-server packages]# rpm -ivh mysql57-community-release-el7-11.noarch.rpm
[root@web-server packages]# yum install -y mysql-server #yum安装
[root@web-server packages]# systemctl start mysqld && systemctl enable mysqld #启动mysql和配置mysql自启
[root@web-server packages]# cat /var/log/mysqld.log | grep -E "root@localhost" #查看初始密码,做好记录
[root@web-server packages]# mysql -u root -p #进入mysq终端,键入上一步查看的初始密码
set global validate_password_policy=0;
set global validate_password_length=1;
set password=password('dbadmin@mysql'); #配置数据库密码
grant all on *.* to root@"%" identified by "dbadmin@mysql"; #授权root用户数据库权限
CREATE DATABASE IF NOT EXISTS owncloud DEFAULT CHARSET utf8;
flush privileges; #刷新数据库
YUM部署PHP7.3
[root@web-server packages]# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y #安装REMI源
[root@web-server packages]# yum install -y php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xmll php73-zip php73-php-zip php73-php-dom php73-php-intl php73-php-libxml php73-php-zip #安装 PHP7.3及其扩展
[root@web-server packages]# systemctl enable php73-php-fpm && systemctl start php73-php-fpm
[root@web-server packages]# sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/opt/remi/php73/php.ini #cgi.fix_pathinfo=1 为 cgi.fix_pathinfo=0 快捷命令
[root@web-server packages]# systemctl restart php73-php-fpm
nginx配置文件
[root@web-server conf.d]#pwd
/etc/nginx/conf.d
[root@web-server conf.d]# vim owncloud.conf
upstream php-handler {
server 127.0.0.1:9000;
#server unix:/var/run/php5-fpm.sock;
}
server {
listen 80;
server_name cloud.ponfey.com;
# Path to the root of your installation
root /data/web/owncloud/;
# set max upload size
client_max_body_size 10G;
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;
rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
index index.php;
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README){
deny all;
}
location / {
# The following 2 rules are only needed with webfinger
rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
try_files $uri $uri/ /index.php;
}
location ~ \.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_pass php-handler;
}
# Optional: set long EXPIRES header on static assets
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 30d;
# Optional: Don't log access to assets
access_log off;
}
}
预览