Added CT's NodeJS, NodeRed, z2mqtt & nextcloud
This commit is contained in:
114
CT-Files/nextcloud/Configs/nginx.conf
Normal file
114
CT-Files/nextcloud/Configs/nginx.conf
Normal file
@@ -0,0 +1,114 @@
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
server_tokens off;
|
||||
client_body_buffer_size 10K;
|
||||
client_header_buffer_size 1k;
|
||||
client_max_body_size 8m;
|
||||
large_client_header_buffers 4 4k;
|
||||
server_names_hash_bucket_size 64;
|
||||
root /usr/share/nginx/html;
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
access_log off;
|
||||
error_log /var/log/nginx/error.log;
|
||||
#Server config for Nextcloud
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
server_name _;
|
||||
root /opt/nextcloud;
|
||||
# Set max upload size
|
||||
client_max_body_size 1G;
|
||||
|
||||
#SetupBlockStart
|
||||
add_header Content-Type text/html;
|
||||
return 200 '<html><head></head><body>To setup this container edit and run the FirstRun script `/opt/Setup/Scripts/FirstRun.sh`</body></html>';
|
||||
#SetupBlockEnd
|
||||
add_header Referrer-Policy "no-referrer" always;
|
||||
add_header X-Download-Options "noopen" always;
|
||||
add_header X-Permitted-Cross-Domain-Policies "none" always;
|
||||
add_header X-Robots-Tag "none" always;
|
||||
fastcgi_send_timeout 300;
|
||||
fastcgi_read_timeout 300;
|
||||
fastcgi_hide_header X-Powered-By;
|
||||
fastcgi_buffers 64 4K;
|
||||
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;
|
||||
|
||||
location = /robots.txt {
|
||||
allow all;
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location ^~ /.well-known {
|
||||
location = /.well-known/carddav { return 301 /remote.php/dav/; }
|
||||
location = /.well-known/caldav { return 301 /remote.php/dav/; }
|
||||
location ^~ /.well-known { return 301 /index.php$uri; }
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
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\/.+)\.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;
|
||||
fastcgi_param modHeadersAvailable true;
|
||||
fastcgi_param front_controller_active true;
|
||||
fastcgi_pass unix:/run/php-fpm8/php-fpm.sock;
|
||||
fastcgi_intercept_errors on;
|
||||
fastcgi_request_buffering off;
|
||||
}
|
||||
|
||||
location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
|
||||
try_files $uri/ =404;
|
||||
index index.php;
|
||||
}
|
||||
|
||||
location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
|
||||
try_files $uri /index.php$request_uri;
|
||||
add_header Cache-Control "public, max-age=15778463";
|
||||
add_header Referrer-Policy "no-referrer" always;
|
||||
add_header X-Download-Options "noopen" always;
|
||||
add_header X-Permitted-Cross-Domain-Policies "none" always;
|
||||
add_header X-Robots-Tag "none" always;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ {
|
||||
try_files $uri /index.php$request_uri;
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
}
|
||||
45
CT-Files/nextcloud/Configs/php.conf
Normal file
45
CT-Files/nextcloud/Configs/php.conf
Normal file
@@ -0,0 +1,45 @@
|
||||
[nextcloud]
|
||||
user = nginx
|
||||
group = nginx
|
||||
listen = /run/php-fpm8/php-fpm.sock
|
||||
listen.owner = nginx
|
||||
listen.group = nginx
|
||||
php_admin_value[disable_functions] = exec,passthru,system
|
||||
php_admin_value[error_log] = /var/log/php-fpm.error.log
|
||||
; OPCACHE SETTINGS
|
||||
php_admin_value[opcache.memory_consumption] = 256
|
||||
php_admin_value[opcache.enable] = 1
|
||||
php_admin_value[opcache.interned_strings_buffer] = 32
|
||||
php_admin_value[opcache.max_accelerated_files] = 50000
|
||||
php_admin_value[opcache.max_wasted_percentage] = 5
|
||||
php_admin_value[opcache.revalidate_freq] = 0
|
||||
php_admin_value[opcache.validate_timestamps] = 1
|
||||
|
||||
; PERFORMANCE LIMITS
|
||||
php_admin_value[max_input_vars] = 1000
|
||||
php_admin_value[upload_max_filesize] = 1G
|
||||
php_admin_value[post_max_size] = 1G
|
||||
php_admin_value[max_input_time] = 60
|
||||
php_admin_value[memory_limit] = 512M
|
||||
|
||||
; SECURITY
|
||||
php_admin_value[cgi.fix_pathinfo] = 0
|
||||
php_admin_value[allow_url_fopen] = Off
|
||||
php_admin_value[file_uploads] = on
|
||||
php_admin_value[open_basedir] = /opt/nextcloud/:/var/nextcloud:/run/php-fpm8/php-fpm.sock:/run/redis/redis.sock:/proc/meminfo:/proc/cpuinfo:/dev/urandom:/tmp
|
||||
php_admin_value[session.use_strict_mode] = 1
|
||||
php_admin_value[session.cookie_httponly] = 1
|
||||
;HTTPSONLY php_admin_value[session.cookie_samesite] = Strict
|
||||
;HTTPSONLY php_admin_value[session.cookie_secure] = 1
|
||||
|
||||
pm = dynamic
|
||||
pm.max_children = 30
|
||||
pm.start_servers = 2
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 5
|
||||
chdir = /
|
||||
env[HOSTNAME] = $HOSTNAME
|
||||
env[PATH] = /usr/local/bin:/usr/bin:/bin
|
||||
env[TMP] = /tmp
|
||||
env[TMPDIR] = /tmp
|
||||
env[TEMP] = /tmp
|
||||
41
CT-Files/nextcloud/Scripts/FirstRun.sh
Normal file
41
CT-Files/nextcloud/Scripts/FirstRun.sh
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/bin/ash
|
||||
#UserSettings
|
||||
ThisScriptConfigured=no
|
||||
## Nextcloud Admin user
|
||||
NextcloudUsername=<Username>
|
||||
NexcloudPassword=<Password>
|
||||
##Nextcloud
|
||||
NextcloudWebProto=http
|
||||
##DB
|
||||
MysqlIP=127.0.0.1
|
||||
MysqlPort=3306
|
||||
MysqlUsername=nextcloud
|
||||
MysqlDatabase=nextcloud
|
||||
MysqlPassword=<Password>
|
||||
|
||||
#Check if script is configured
|
||||
if [ $ThisScriptConfigured = no ]; then
|
||||
echo "Script is not configured"
|
||||
exit
|
||||
fi
|
||||
sudo -u nginx php8 /opt/nextcloud/occ maintenance:install --database mysql --database-name "$MysqlDatabase" --database-host "$MysqlIP" --database-port "$MysqlPort" --database-user "$MysqlUsername" --database-pass "$MysqlPassword" --database-table-space "" --admin-user "$NextcloudUsername" --admin-pass "$NexcloudPassword" --data-dir /var/nextcloud
|
||||
|
||||
sed -n -i '/#SetupBlockStart/{:a;N;/#SetupBlockEnd/!ba;N;s/.*//};p' /etc/nginx/nginx.conf
|
||||
service nginx reload
|
||||
|
||||
sudo -u nginx php8 /opt/nextcloud/occ db:convert-filecache-bigint
|
||||
sudo -u nginx php8 /opt/nextcloud/occ db:add-missing-indices
|
||||
sudo -u nginx php8 /opt/nextcloud/occ app:disable firstrunwizard
|
||||
sudo -u nginx php8 /opt/nextcloud/occ config:system:set default_language --value=nl
|
||||
sudo -u nginx php8 /opt/nextcloud/occ config:system:set default_locale --value=nl
|
||||
sudo -u nginx php8 /opt/nextcloud/occ config:system:set default_phone_region --value=nl
|
||||
sudo -u nginx php8 /opt/nextcloud/occ config:system:set skeletondirectory --value=
|
||||
sudo -u nginx php8 /opt/nextcloud/occ config:system:set memcache.local --value='\OC\Memcache\APCu'
|
||||
sudo -u nginx php8 /opt/nextcloud/occ config:system:set trashbin_retention_obligation --value=30,30
|
||||
sudo -u nginx php8 /opt/nextcloud/occ config:system:set memcache.distributed --value='\OC\Memcache\Redis'
|
||||
sudo -u nginx php8 /opt/nextcloud/occ config:system:set memcache.locking --value='\OC\Memcache\Redis'
|
||||
sudo -u nginx php8 /opt/nextcloud/occ config:system:set redis host --value=localhost
|
||||
sudo -u nginx php8 /opt/nextcloud/occ config:system:set redis port --value=6379
|
||||
sudo -u nginx php8 /opt/nextcloud/occ config:system:set trusted_domains 1 --value="$(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)"
|
||||
sudo -u nginx php8 /opt/nextcloud/occ config:system:set overwrite.cli.url --value="$NextcloudWebProto://$(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)"
|
||||
sudo -u nginx php8 /opt/nextcloud/occ config:system:set overwriteprotocol --value="$NextcloudWebProto"
|
||||
28
CT-Files/nextcloud/Scripts/Init.sh
Normal file
28
CT-Files/nextcloud/Scripts/Init.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/ash
|
||||
#Setup Nginx repo
|
||||
echo "@nginx http://nginx.org/packages/mainline/alpine/v$(egrep -o '^[0-9]+\.[0-9]+' /etc/alpine-release)/main" >> /etc/apk/repositories
|
||||
mv /opt/Setup/nginx_signing.rsa.pub /etc/apk/keys/nginx_signing.rsa.pub
|
||||
|
||||
#Install Nginx
|
||||
apk add nginx@nginx
|
||||
|
||||
#Configure Nginx
|
||||
rm -rf /etc/nginx/conf.d
|
||||
mv /opt/Setup/Configs/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
#Configure Php-Fpm
|
||||
rm -rf /etc/php8/php-fpm.d/*
|
||||
mv /opt/Setup/Configs/php.conf /etc/php8/php-fpm.d/nextcloud.conf
|
||||
|
||||
#Install Nextcloud
|
||||
mkdir /opt/nextcloud /var/nextcloud
|
||||
tar jxf /opt/Setup/nextcloud.tar.bz2 -C /opt/nextcloud --strip 1
|
||||
rm -rf /opt/Setup/nextcloud.tar.bz2
|
||||
chown -R nginx:nginx /opt/nextcloud
|
||||
chown -R nginx:nginx /var/nextcloud
|
||||
echo "*/5 * * * * php8 -f /opt/nextcloud/cron.php > /dev/null 2>&1" >> /etc/crontabs/nginx
|
||||
echo "apc.enable_cli=1" >> /etc/php8/php.ini
|
||||
#Enable services on boot
|
||||
rc-update add nginx
|
||||
rc-update add php-fpm8
|
||||
rc-update add redis
|
||||
Reference in New Issue
Block a user