Wie konfigurieren Sie mehrere subdomain mit SSL im Apache?
Konfiguration:
- Debian
- Apache2
- Wildcard SSL für *.example.com
- subdomain: a.example.com, b.example.com.
- 1 dedicated server
- Websites sind in NodeJS (ProxyPass...)
Denn jetzt bin ich in der Lage zu bekommen a.example.com zu arbeiten.
Aber wie kann ich machen a.example.com UND b.example.com arbeiten auf dem gleichen server ?
/etc/apache2/site-enable/a.example.com.conf
<VirtualHost *:80>
ServerName a.example.com
Redirect permanent /https://a.example.com
</VirtualHost>
<VirtualHost *:80>
ServerName www.a.example.com
Redirect permanent /https://a.example.com
</VirtualHost>
Listen 443
<VirtualHost *:443>
ServerName a.example.com
ServerAlias www.a.example.com
ProxyRequests off
LimitRequestLine 150000
LimitRequestFieldSize 150000
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass http://localhost:4949/
ProxyPassReverse http://localhost:4949/
</Location>
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:!LOW:!aNULL:!eNULL
SSLCertificateFile /etc/ssl/2__.example.fr.crt
SSLCertificateKeyFile /root/XXXXXX.key
SSLCertificateChainFile /etc/ssl/1_root_bundle.crt
</VirtualHost>
UPDATE ---
Wenn ich es versuchen:
/etc/apache2/site-enable/b.example.com.conf
<VirtualHost *:80>
ServerName b.example.com
Redirect permanent /https://b.example.com
</VirtualHost>
<VirtualHost *:80>
ServerName www.b.example.com
Redirect permanent /https://b.example.com
/VirtualHost>
Listen 443
<VirtualHost *:443>
ServerName b.example.com
ServerAlias www.b.example.com
ProxyRequests off
LimitRequestLine 150000
LimitRequestFieldSize 150000
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass http://localhost:6949/
ProxyPassReverse http://localhost:6949/
</Location>
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:!LOW:!aNULL:!eNULL
SSLCertificateFile /etc/ssl/2__.example.fr.crt
SSLCertificateKeyFile /root/XXXXXX.key
SSLCertificateChainFile /etc/ssl/1_root_bundle.crt
</VirtualHost>
Ich bin immer dies
[....] Restarting web server: apache2[Thu Jul 21 14:58:01 2016] [warn] module passenger_module is already loaded, skipping
[Thu Jul 21 14:58:01 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence
[Thu Jul 21 14:58:01 2016] [warn] NameVirtualHost *:80 has no VirtualHosts
... waiting [Thu Jul 21 14:58:02 2016] [warn] module passenger_module is already loaded, skipping
[Thu Jul 21 14:58:02 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence
[Thu Jul 21 14:58:02 2016] [warn] NameVirtualHost *:80 has no VirtualHosts
(98)Address already in use: make_sock: could not bind to address [::]:443
- - - - UPDATE
Habe ich entfernt, Hören Sie auf der b 443.exemple.com.conf
Aber jetzt habe ich dieses:
a.example.com ---> b.example.com
b.example.com ---> b.example.com
Das problem ist, dass wenn ich versuche, Zugriff auf einen, ich bin redirected to b
Was ich falsch mache ?
/etc/apache2/site-enable/b.example.com.conf
<VirtualHost *:80>
ServerName b.example.com
Redirect permanent /https://b.example.com
</VirtualHost>
<VirtualHost *:80>
ServerName www.b.example.com
Redirect permanent /https://b.example.com
/VirtualHost>
<VirtualHost *:443>
ServerName b.example.com
ServerAlias www.b.example.com
ProxyRequests off
LimitRequestLine 150000
LimitRequestFieldSize 150000
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass http://localhost:6949/
ProxyPassReverse http://localhost:6949/
</Location>
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:!LOW:!aNULL:!eNULL
SSLCertificateFile /etc/ssl/2__.example.fr.crt
SSLCertificateKeyFile /root/XXXXXX.key
SSLCertificateChainFile /etc/ssl/1_root_bundle.crt
</VirtualHost>
-- UPDATE EINE LÖSUNG GEFUNDEN : )
Schließlich fand ich eine Lösung für mein problem, danke für Eure Hilfe !
<IfModule mod_ssl.c>
Listen 443
NameVirtualHost *:443
</IfModule>
<VirtualHost *:443>
ServerName www.example.fr
DocumentRoot "/var/www/html/404"
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:!LOW:!aNULL:!eNULL
SSLCertificateFile /etc/ssl/2__.example.fr.crt
SSLCertificateKeyFile /root/XXXXX.key
SSLCertificateChainFile /etc/ssl/1_root_bundle.crt
</VirtualHost>
<VirtualHost *:80>
ServerName www.example.fr
Redirect permanent /https://a.example.fr
</VirtualHost>
<VirtualHost *:80>
ServerName a.example.fr
Redirect permanent /https://a.example.fr
</VirtualHost>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName a.example.fr
ProxyRequests off
LimitRequestLine 150000
LimitRequestFieldSize 150000
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass http://localhost:4949/
ProxyPassReverse http://localhost:4949/
</Location>
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:!LOW:!aNULL:!eNULL
SSLCertificateFile /etc/ssl/2__.example.fr.crt
SSLCertificateKeyFile /root/serveurA.key
SSLCertificateChainFile /etc/ssl/1_root_bundle.crt
</VirtualHost>
<VirtualHost *:80>
ServerName b.example.fr
Redirect permanent /https://b.example.fr
</VirtualHost>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName b.example.fr
ProxyRequests off
LimitRequestLine 150000
LimitRequestFieldSize 150000
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass http://localhost:6949/
ProxyPassReverse http://localhost:6949/
</Location>
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:!LOW:!aNULL:!eNULL
SSLCertificateFile /etc/ssl/2__.example.fr.crt
SSLCertificateKeyFile /root/serveurA.key
SSLCertificateChainFile /etc/ssl/1_root_bundle.crt
</VirtualHost>
- Gut, fügen Sie einfach ein zweites ssl-host und konfigurieren Sie das gleiche Zertifikat-Dateien verwendet werden.
- Bitte siehe mein update 🙂
- Sieht aus wie Sie verwenden den Befehl
Listen 443
zweimal, einmal in jeder Datei? - Ja ! Es ist besser. Aber ich habe ein anderes problem jetzt, bitte siehe mein update.
- Dies könnte ein Effekt verursacht durch die Tatsache, dass b.example.com könnte als der "Standard-host", die von Ihrem setup. Dies ist eine Frage, die, um Sie die Konfigurationen.
- Eine andere Sache: ich würde sagen, es würde Sinn machen, definieren Sie die ssl-Versionen von www.*.example.com als separate hosts zu, so dass Sie dieAnforderungen an diejenigen, die "nicht-www" - Host, genau wie du es mit der http-zu-https-Umleitung. Ich sehe keinen Grund zu halten, beide Varianten verwendbar.
- In der Tat die Reihenfolge der Konfiguration ändern, was ich bin in der Lage, Zugang. Aber das problem ist immer noch da: - wenn ich will a.example.com ich bekommen a.example.com - wenn ich will b.example.com ich bekommen a.example.com Was ich m tun falsch ... ?
Du musst angemeldet sein, um einen Kommentar abzugeben.
Ändern Sie Ihre virtualhost-code für die Platzhalter (*.example.com) für alle sub-domain, um diese Funktion zu implementieren Ihr SSL-Zertifikat sollte ein wildcard unterstützt für mehrere sub-domains
Ändern /hinzufügen von zwei Zeilen in
<virtualhost>
code von apache httpd.conf oder ssl.conf DateiBeispiele :