标签:tin pen type die slb rdd uid res topic
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install php74-php-fpm php74-php-cli php74-php-gd php74-php-mcrypt php74-php-mysql php74-php-pear php74-php-xml php74-php-mbstring php74-php-pdo php74-php-json php74-php-pecl-apcu php74-php-pecl-apcu-devel php74-php-ldap php74-php-intl php74-php-zip
yum install nginx -y
vi /etc/opt/remi/php74/php-fpm.d/www.conf
在第 24 行和第 26行,user 和 group 赋值为 nginx。
user = nginx
group = nginx
在第 38行,确保 php-fpm 运行在指定端口。
listen = 127.0.0.1:9000
取消第 396-400 行的注释,启用 php-fpm 的系统环境变量。
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
保存文件并退出 vim 编辑器。
下一步,就是在更改3个目录为nginx 用户。
chown -R nginx.nginx /var/opt/remi/php74/lib/php/session
chown -R nginx.nginx /var/opt/remi/php74/lib/php/wsdlcache
chown -R nginx.nginx /var/opt/remi/php74/lib/php/opcache
然后启动 php-fpm 和 Nginx,并且将它们设置为随开机启动的服务。
systemctl restart php74-php-fpm
systemctl start nginx
systemctl enable php74-php-fpm
systemctl enable nginx
cd /usr/local/src && wget http://gosspublic.alicdn.com/ossfs/ossfs_1.80.6_centos7.0_x86_64.rpm && yum install ossfs_1.80.6_centos7.0_x86_64.rpm
#配置key文件,AccessKey和AccessID替换成你自己的
echo nextlcoud:AccessKey:AccessID > /etc/passwd-ossfs
chmod 640 chmod 640 /etc/passwd-ossfs
#挂载oss至本机,其中995和998是nginx用户的uid和group id,改成你自己的就可以
ossfs nextlcoud /data/wwwroot/default/nextcloud/data -ourl=oss-cn-shengzhen-internal.aliyuncs.com -ouid=995 -ogid=998 -oumask=007 -o allow_other
#查看挂载情况
[root@nexus ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 118G 67G 46G 60% /
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 12K 3.9G 1% /dev/shm
tmpfs 3.9G 377M 3.5G 10% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
tmpfs 783M 0 783M 0% /run/user/0
tmpfs 783M 0 783M 0% /run/user/1000
ossfs 256T 0 256T 0% /data/wwwroot/default/nextcloud/data
cd /usr/local/src && wget https://download.nextcloud.com/server/releases/nextcloud-19.0.0.zip && unzip nextcloud-19.0.0.zip && mv nextcloud/* /data/wwwroot/default/nextcloud/
chown nginx.nginx -R /data/wwwroot/default/nextcloud
由于我这用的是slb,证书在slb上处理,所以改了下官方的配置文件,如果证书在nginx上处理的话,用官方的nginx配置文件即可
upstream php-handler {
server 127.0.0.1:9009;
#server unix:/var/run/php/php7.4-fpm.sock;
}
#server {
# listen 80;
# server_name pan.ugly.cn;
# return 301 https://$server_name:443$request_uri;
#}
server {
listen 8081;
server_name pan.ugly.cn;
# 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=15768000; includeSubDomains; preload;" always;
#
# WARNING: Only add the preload option once you read about
# the consequences in https://hstspreload.org/. This option
# will add the domain to a hardcoded list that is shipped
# in all major browsers and getting removed from this list
# could take several months.
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "none" always;
add_header X-XSS-Protection "1; mode=block" always;
# Remove X-Powered-By, which is an information leak
fastcgi_hide_header X-Powered-By;
# Path to the root of your installation
root /data/wwwroot/default/nextcloud/;
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;
# The following rule is only needed for the Social app.
# Uncomment it if you‘re planning to use this app.
#rewrite ^/.well-known/webfinger /public.php?service=webfinger last;
location = /.well-known/carddav {
return 301 $scheme://$host:$server_port/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $scheme://$host:$server_port/remote.php/dav;
}
# set max upload size
client_max_body_size 2000M;
fastcgi_buffers 64 4K;
# Enable gzip but do not remove ETag headers
gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
# Uncomment if your server is build with the ngx_pagespeed module
# This module is currently not supported.
#pagespeed off;
location / {
rewrite ^ /index.php;
}
location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
deny all;
}
location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) {
fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_param HTTPS on;
# Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
# Enable pretty urls
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
try_files $uri/ =404;
index index.php;
}
# Adding the cache control header for js, css and map files
# Make sure it is BELOW the PHP block
location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
try_files $uri /index.php$request_uri;
add_header Cache-Control "public, max-age=15778463";
# 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=15768000; includeSubDomains; preload;" always;
#
# WARNING: Only add the preload option once you read about
# the consequences in https://hstspreload.org/. This option
# will add the domain to a hardcoded list that is shipped
# in all major browsers and getting removed from this list
# could take several months.
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "none" always;
add_header X-XSS-Protection "1; mode=block" always;
# Optional: Don‘t log access to assets
access_log off;
}
location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ {
try_files $uri /index.php$request_uri;
# Optional: Don‘t log access to other assets
access_log off;
}
}
create database nextcloud_db;
create user nextclouduser@localhost identified by ‘nextcloudusertest@‘;
grant all privileges on nextcloud_dbtest.* to nextclouduser@localhost identified by ‘nextclouduserwww‘;
flush privileges;
不出意外的话,访问域名就可以进入到nextcloud的安装界面了
标签:tin pen type die slb rdd uid res topic
原文地址:https://www.cnblogs.com/uglyliu/p/13337261.html