Deployment: .htaccess-Weiterleitung für Strato (kein Symlink-Ziel), Web-PHP pro Ordner, erstes Deployment ohne Gesundheitscheck
Erfolgreich getestet auf Strato (test.fewo-stommer.de). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cb1e4cbc63
commit
92c796de2e
2 files changed
+23
-2
No files matched your search
@@ -59,6 +59,23 @@ switch_to() {
|
||||
case "$cmd" in
|
||||
setup)
|
||||
mkdir -p releases shared/storage/app/public shared/storage/framework/cache/data shared/storage/framework/sessions shared/storage/framework/views shared/storage/logs
|
||||
# For hosting panels that cannot point a domain at a symlink: the domain points at this folder,
|
||||
# everything is served from current/public and all internal files are blocked.
|
||||
# Strato: the web server's PHP version can be chosen per folder; use the same version as the CLI.
|
||||
web_php="$(printf '%s' "$php" | grep -oE 'RZphp[0-9]+' | grep -oE '[0-9]+' || true)"
|
||||
{ [[ -n "$web_php" ]] && echo "AddType application/x-httpd-php$web_php .php"; cat <<'HTACCESS'
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteRule ^(releases|shared|current/(?!public/)|\.|upload-) - [F,L]
|
||||
RewriteCond %{REQUEST_URI} !^/current/public/
|
||||
RewriteRule ^(.*)$ current/public/$1 [L]
|
||||
</IfModule>
|
||||
<IfModule !mod_rewrite.c>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
HTACCESS
|
||||
} > .htaccess
|
||||
echo ".htaccess angelegt (Domain-Ziel: $base${web_php:+, Web-PHP $web_php})."
|
||||
if [[ -f shared/.env ]]; then echo "shared/.env vorhanden."; else echo "HINWEIS: Bitte $base/shared/.env anlegen (Vorlage: .env.production.example)."; fi
|
||||
echo "PHP: $("$php" -v | head -n 1)"
|
||||
;;
|
||||
@@ -164,6 +181,8 @@ build() {
|
||||
|
||||
health_check() {
|
||||
[[ -n "$DEPLOY_URL" ]] || { echo "Kein DEPLOY_URL gesetzt – Gesundheitscheck übersprungen."; return 0; }
|
||||
# First deployment: the domain does not point to current/public yet.
|
||||
[[ "${SKIP_HEALTH_CHECK:-}" == "1" ]] && { echo "SKIP_HEALTH_CHECK=1 – Gesundheitscheck übersprungen."; return 0; }
|
||||
say "Prüfe $DEPLOY_URL/up"
|
||||
for attempt in 1 2 3 4 5; do
|
||||
if curl -fsS --max-time 15 "$DEPLOY_URL/up" > /dev/null; then
|
||||
|
||||
Reference in new issue
Block a user