Update arch_install.sh
This commit is contained in:
parent
fb9737cbe0
commit
00ffdb60ea
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
# Nextcloud + Apache + PHP 8.3 (php-legacy) + MariaDB + Valkey on Arch Linux
|
||||
# Production-oriented, reverse-proxy aware
|
||||
# Optimized version with PHP extension loading fixes
|
||||
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
|
@ -58,16 +58,6 @@ check_vars() {
|
|||
done
|
||||
}
|
||||
|
||||
enable_php_ext() {
|
||||
local ext="$1"
|
||||
if ! grep -Eq "^[[:space:]]*extension=${ext}\.so" "$PHP_INI"; then
|
||||
sed -i "/^;extension=${ext}\.so/s/^;//" "$PHP_INI" || true
|
||||
if ! grep -Eq "^[[:space:]]*extension=${ext}\.so" "$PHP_INI"; then
|
||||
printf "\nextension=%s.so\n" "$ext" >> "$PHP_INI"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
set_ini_value() {
|
||||
local key="$1"
|
||||
local value="$2"
|
||||
|
|
@ -111,7 +101,7 @@ pacman -Syu --noconfirm
|
|||
pacman -S --needed --noconfirm \
|
||||
apache mariadb valkey cronie \
|
||||
php-legacy php-legacy-fpm php-legacy-gd php-legacy-intl php-legacy-sodium \
|
||||
php-legacy-apcu php-legacy-redis php-legacy-imagick \
|
||||
php-legacy-apcu php-legacy-redis php-legacy-imagick php-legacy-igbinary \
|
||||
curl wget tar bzip2 unzip sudo
|
||||
|
||||
KV_CONF="$(detect_kv_conf)"
|
||||
|
|
@ -142,18 +132,34 @@ FLUSH PRIVILEGES;
|
|||
SQL
|
||||
|
||||
# =========================
|
||||
# PHP
|
||||
# PHP CONFIGURATION (FIXED)
|
||||
# =========================
|
||||
log "Configuring PHP 8.3 legacy stack"
|
||||
for ext in gd intl mysqli pdo_mysql sodium zip apcu redis imagick; do
|
||||
enable_php_ext "$ext"
|
||||
|
||||
# First, remove existing extension lines to avoid duplicates
|
||||
for ext in gd intl mysqli pdo_mysql sodium zip apcu redis igbinary imagick; do
|
||||
sed -i "/extension=${ext}\.so/d" "$PHP_INI"
|
||||
sed -i "/;extension=${ext}\.so/d" "$PHP_INI"
|
||||
done
|
||||
|
||||
# Force correct loading order at the top of php.ini
|
||||
# igbinary MUST load before redis to avoid "undefined symbol" errors
|
||||
printf "extension=igbinary.so\nextension=redis.so\nextension=imagick.so\nextension=gd.so\nextension=intl.so\nextension=mysqli.so\nextension=pdo_mysql.so\nextension=sodium.so\nextension=zip.so\nextension=apcu.so\n" | cat - "$PHP_INI" > temp && mv temp "$PHP_INI"
|
||||
|
||||
set_ini_value "memory_limit" "512M"
|
||||
set_ini_value "upload_max_filesize" "1024M"
|
||||
set_ini_value "post_max_size" "1024M"
|
||||
set_ini_value "output_buffering" "Off"
|
||||
|
||||
# Opcache
|
||||
if ! grep -Eq '^[[:space:]]*zend_extension[[:space:]]*=.*opcache' "$PHP_INI"; then
|
||||
sed -i "1i zend_extension=opcache" "$PHP_INI"
|
||||
fi
|
||||
set_ini_value "opcache.enable" "1"
|
||||
set_ini_value "opcache.memory_consumption" "256"
|
||||
set_ini_value "opcache.save_comments" "1"
|
||||
|
||||
# PHP-FPM Socket Setup
|
||||
set_fpm_value "user" "http"
|
||||
set_fpm_value "group" "http"
|
||||
set_fpm_value "listen" "/run/php-fpm-legacy/php-fpm.sock"
|
||||
|
|
@ -181,27 +187,21 @@ systemctl enable --now "${KV_SERVICE}"
|
|||
systemctl restart "${KV_SERVICE}"
|
||||
|
||||
# =========================
|
||||
# APACHE
|
||||
# APACHE CONFIGURATION (FIXED)
|
||||
# =========================
|
||||
log "Configuring Apache"
|
||||
HTTPD_CONF="/etc/httpd/conf/httpd.conf"
|
||||
|
||||
# Enable core modules
|
||||
# Enable required modules
|
||||
for mod in proxy proxy_fcgi rewrite headers remoteip env mime dir setenvif dav dav_fs dav_lock; do
|
||||
sed -ri "s|^#(LoadModule ${mod}_module)| \1|" "${HTTPD_CONF}"
|
||||
done
|
||||
|
||||
# CLEANUP: Disable problematic default extra configs
|
||||
sed -i 's/^[[:space:]]*Include conf\/extra\/httpd-dav.conf/#&/' "${HTTPD_CONF}"
|
||||
sed -i 's/^[[:space:]]*Include conf\/extra\/httpd-autoindex.conf/#&/' "${HTTPD_CONF}"
|
||||
# Specifically remove any wildcard includes added by previous failed runs
|
||||
# CLEANUP: Aggressively disable all default extra configs and wildcard includes
|
||||
sed -i 's/^[[:space:]]*Include conf\/extra\/httpd-.*\.conf/#&/' "${HTTPD_CONF}"
|
||||
sed -i '/IncludeOptional conf\/extra\/\*\.conf/d' "${HTTPD_CONF}"
|
||||
|
||||
if ! grep -Eq '^[[:space:]]*ServerName[[:space:]]+' "${HTTPD_CONF}"; then
|
||||
printf "\nServerName %s\n" "${DOMAIN}" >> "${HTTPD_CONF}"
|
||||
fi
|
||||
|
||||
# Add the specific Nextcloud include ONLY
|
||||
# Add ONLY the specific Nextcloud include
|
||||
if ! grep -Fq "Include conf/extra/nextcloud.conf" "${HTTPD_CONF}"; then
|
||||
printf "\nInclude conf/extra/nextcloud.conf\n" >> "${HTTPD_CONF}"
|
||||
fi
|
||||
|
|
@ -224,6 +224,8 @@ cat > /etc/httpd/conf/extra/nextcloud.conf <<EOF
|
|||
<FilesMatch "\.php$">
|
||||
SetHandler "proxy:unix:/run/php-fpm-legacy/php-fpm.sock|fcgi://localhost/"
|
||||
</FilesMatch>
|
||||
|
||||
ErrorLog "/var/log/httpd/nextcloud_error.log"
|
||||
</VirtualHost>
|
||||
EOF
|
||||
|
||||
|
|
@ -249,7 +251,7 @@ sudo -u http "${PHP_BIN}" "${NC_DIR}/occ" maintenance:install \
|
|||
--admin-user "${ADMIN_USER}" --admin-pass "${ADMIN_PASS}" \
|
||||
--data-dir "${NC_DATA_DIR}"
|
||||
|
||||
# Apply Cache and Trusted Domain configs
|
||||
# Apply System Configs
|
||||
sudo -u http "${PHP_BIN}" "${NC_DIR}/occ" config:system:set trusted_domains 1 --value="${DOMAIN}"
|
||||
sudo -u http "${PHP_BIN}" "${NC_DIR}/occ" config:system:set memcache.local --value='\OC\Memcache\APCu'
|
||||
sudo -u http "${PHP_BIN}" "${NC_DIR}/occ" config:system:set memcache.locking --value='\OC\Memcache\Redis'
|
||||
|
|
|
|||
Loading…
Reference in New Issue