location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
#Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
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/ =404;
index index.php;
}
# 添加js和css文件的缓存控制头
location ~* \.(?:css|js)$ {
try_files $uri /index.php$uri$is_args$args;
add_header Cache-Control “public,max-age=7200”;
add_header Strict-Transport-Security “max-age=15768000;
includeSubDomains; preload;”;
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;
access_log off;
}
location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
try_files $uri /index.php$uri$is_args$args;
access_log off;
}
}
vim nginx.conf
include nextcloud.conf;
service nginx start
8.配置php上传大小
vim /etc/php.ini
max_execution_time = 0
post_max_size = 512M
upload_max_filesize = 512M
service php-fpm start
9.配置nextcloud
10.nextcloud 配置redis缓存
使用Redis做内存缓存可以有效提升程序运行速度.
curl -O?http://download.redis.io/releases/redis-3.2.8.tar.gz
tar -zxvf redis-3.2.8.tar.gz
cd redis-3.2.8/deps/
make geohash-int hiredis jemalloc linenoise lua
cd ..
make && make install
cd utils/
./install_server.sh
配置redis
vim /etc/redis/6379.conf
# requirepass foobared
requirepass ExpvUwNOk9XRawC8
bind 192.168.40.200
启动
redis-server /etc/redis/6379.conf
配置nextcloud
cd /usr/local/nginx/html/nextcloud/config
vim config.php?
‘memcache.local’ => ‘\OC\Memcache\Redis’,
‘redis’ => array(
‘host’ => ‘192.168.40.200’,
‘port’ => 6379,
‘password’ => ‘ExpvUwNOk9XRawC8’,
),
刷新页面
设置定时
*/15 * * * * /usr/bin/php /usr/local/nginx/html/nextcloud/cron.php >/dev/null
文章来自微信公众号:云技术实践
(编辑:ASP站长网)
|