Add set-domain.php; setup applies SHOP_DOMAIN/QLO_SSL on every run
QloApps redirects every request to the domain stored in the DB, so a wrong domain or HTTPS without TLS in front ends in ERR_SSL_PROTOCOL_ERROR. docker/set-domain.php updates PS_SHOP_DOMAIN(_SSL), shop_url, SSL flags and .htaccess; the setup script now calls it with the .env values, so editing .env and re-running fixes the domain. Troubleshooting table in docker/TESTSERVER.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -70,6 +70,28 @@ nginx -t && systemctl reload nginx
|
||||
|
||||
Wichtig ist `proxy_set_header X-Forwarded-Proto $scheme;` – daran erkennt QloApps HTTPS. Ohne die Zeile gibt es Umleitungsschleifen.
|
||||
|
||||
## Fehlersuche
|
||||
|
||||
QloApps speichert Domain und HTTPS-Modus in der Datenbank und **leitet jeden Aufruf dorthin um**.
|
||||
Steht dort eine falsche Domain oder `https`, obwohl nginx (noch) kein HTTPS liefert, endet der Browser bei
|
||||
`ERR_SSL_PROTOCOL_ERROR` oder einer fremden Seite.
|
||||
|
||||
Domain/HTTPS ändern: in `.env` `SHOP_DOMAIN` und `QLO_SSL` anpassen und das Setup-Skript erneut starten, oder direkt:
|
||||
|
||||
```powershell
|
||||
# hinter nginx mit HTTPS
|
||||
docker compose -f docker-compose.yml -f docker-compose.server.yml exec -u www-data app php docker/set-domain.php hotel-test.example.de 1
|
||||
# direkter Test im LAN ohne nginx (http://<IP>:8080)
|
||||
docker compose -f docker-compose.yml -f docker-compose.server.yml exec -u www-data app php docker/set-domain.php 192.168.1.50:8080 0
|
||||
```
|
||||
|
||||
| Symptom | Ursache |
|
||||
|---|---|
|
||||
| `ERR_SSL_PROTOCOL_ERROR` beim Aufruf von `http://<IP>:8080` | Shop steht auf HTTPS + Domain → Umleitung auf `https://…`. Für den Direkttest `set-domain.php <IP>:8080 0` |
|
||||
| `ERR_SSL_PROTOCOL_ERROR` beim Aufruf der Domain | nginx liefert auf Port 443 kein TLS (`listen 443 ssl;` fehlt) oder DNS zeigt auf einen anderen Server. Prüfen: `curl -vk https://<domain>` |
|
||||
| Endlose Umleitung | `proxy_set_header X-Forwarded-Proto $scheme;` fehlt in nginx |
|
||||
| Seite lädt, aber ohne Bilder/CSS | Domain in der DB passt nicht zur aufgerufenen Adresse → `set-domain.php` |
|
||||
|
||||
## Betrieb
|
||||
|
||||
| Aufgabe | Befehl (im Repo-Ordner) |
|
||||
|
||||
36
docker/set-domain.php
Normal file
36
docker/set-domain.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Set the shop's host name and HTTPS mode (QloApps stores both in the database and
|
||||
* redirects every request to that host).
|
||||
* docker compose exec -u www-data app php docker/set-domain.php <host[:port]> <ssl 0|1>
|
||||
* Examples:
|
||||
* php docker/set-domain.php hotel-test.example.de 1 (behind nginx with HTTPS)
|
||||
* php docker/set-domain.php 192.168.1.50:8080 0 (direct LAN test, no nginx)
|
||||
*/
|
||||
if (PHP_SAPI !== 'cli') {
|
||||
exit("CLI only\n");
|
||||
}
|
||||
if ($argc < 3 || !in_array($argv[2], array('0', '1'), true)) {
|
||||
fwrite(STDERR, "Usage: php docker/set-domain.php <host[:port]> <ssl 0|1>\n");
|
||||
exit(1);
|
||||
}
|
||||
$domain = preg_replace('#^https?://#i', '', rtrim(trim($argv[1]), '/'));
|
||||
$ssl = (int)$argv[2];
|
||||
if (!preg_match('/^[A-Za-z0-9.-]+(:\d+)?$/', $domain)) {
|
||||
fwrite(STDERR, "Invalid host: $domain\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
define('_PS_ADMIN_DIR_', __DIR__);
|
||||
require __DIR__.'/../config/config.inc.php';
|
||||
|
||||
Configuration::updateValue('PS_SHOP_DOMAIN', $domain);
|
||||
Configuration::updateValue('PS_SHOP_DOMAIN_SSL', $domain);
|
||||
Configuration::updateValue('PS_SSL_ENABLED', $ssl);
|
||||
Configuration::updateValue('PS_SSL_ENABLED_EVERYWHERE', $ssl);
|
||||
Db::getInstance()->update('shop_url', array('domain' => pSQL($domain), 'domain_ssl' => pSQL($domain)), 'main = 1');
|
||||
Tools::generateHtaccess();
|
||||
Tools::clearSmartyCache();
|
||||
Tools::clearCache();
|
||||
|
||||
echo 'Shop URL: '.($ssl ? 'https' : 'http').'://'.$domain."/\n";
|
||||
@@ -97,6 +97,9 @@ if (Test-Path config/settings.inc.php) {
|
||||
--newsletter=0
|
||||
}
|
||||
|
||||
Step 'Shop domain and HTTPS (from .env: SHOP_DOMAIN, QLO_SSL)'
|
||||
Invoke-Docker @compose exec -T -u www-data app php docker/set-domain.php $envVars['SHOP_DOMAIN'] $envVars['QLO_SSL']
|
||||
|
||||
Step 'German shop texts'
|
||||
Invoke-Docker @compose exec -T -u www-data app php docker/apply-translations.php de
|
||||
|
||||
|
||||
Reference in New Issue
Block a user