Apache Server Vhost Datei
Hallo Administratoren/innen,
ich bin eigentlich nur Entwickler und brauche daher mal eure Hilfe zu einer Vhost Datei eines Ubuntu Servers.
Hoffe ich bin hier richtig und ihr könnt mir helfen. Also ich brauch eine Vhost datei, die erstmal per SSL geschützt ist, dies klappt auch.
Wenn ich jetzt aber www.beta.xxx.de aufrufe komme ich zur www.xxx.de seite es steht aber noch www.beta.xxx.de da. Könnte man nicht eine weiterleitung zu https://www.beta.xxx.de machen? Das dies auch direkt richtig in der adressleiste angezeigt wird?
Also mein bisherhiger Versuch sieht so aus: Gibt es da verbesserungsvorschläge und könnt ihr mir tipps geben die Probleme zubeheben die ich da habe?
<VirtualHost *:443>
ServerAdmin support@xxx.de
DocumentRoot /var/www/xxx.de
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
<Directory /var/www/xxx.de>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
SSLEngine On
SSLCertificateFile /etc/apache2/mycert/server.crt
SSLCertificateKeyFile /etc/apache2/mycert/server.key
</VirtualHost>
<VirtualHost *:443>
ServerName subs.xxx.de
ServerAlias *.xxx.de
UseCanonicalName Off
VirtualDocumentRoot /var/www/%-3+
SSLEngine On
SSLCertificateFile /etc/apache2/mycert/server.crt
SSLCertificateKeyFile /etc/apache2/mycert/server.key
CustomLog /var/www/access.log common
ErrorLog /var/www/error.log
<Directory />
Options FollowSymLinks
</Directory>
</VirtualHost>
ich bin eigentlich nur Entwickler und brauche daher mal eure Hilfe zu einer Vhost Datei eines Ubuntu Servers.
Hoffe ich bin hier richtig und ihr könnt mir helfen. Also ich brauch eine Vhost datei, die erstmal per SSL geschützt ist, dies klappt auch.
Wenn ich jetzt aber www.beta.xxx.de aufrufe komme ich zur www.xxx.de seite es steht aber noch www.beta.xxx.de da. Könnte man nicht eine weiterleitung zu https://www.beta.xxx.de machen? Das dies auch direkt richtig in der adressleiste angezeigt wird?
Also mein bisherhiger Versuch sieht so aus: Gibt es da verbesserungsvorschläge und könnt ihr mir tipps geben die Probleme zubeheben die ich da habe?
<VirtualHost *:443>
ServerAdmin support@xxx.de
DocumentRoot /var/www/xxx.de
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
<Directory /var/www/xxx.de>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
- Possible values include: debug, info, notice, warn, error, crit,
- alert, emerg.
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
SSLEngine On
SSLCertificateFile /etc/apache2/mycert/server.crt
SSLCertificateKeyFile /etc/apache2/mycert/server.key
</VirtualHost>
<VirtualHost *:443>
ServerName subs.xxx.de
ServerAlias *.xxx.de
UseCanonicalName Off
VirtualDocumentRoot /var/www/%-3+
SSLEngine On
SSLCertificateFile /etc/apache2/mycert/server.crt
SSLCertificateKeyFile /etc/apache2/mycert/server.key
CustomLog /var/www/access.log common
ErrorLog /var/www/error.log
<Directory />
Options FollowSymLinks
</Directory>
</VirtualHost>
Bitte markiere auch die Kommentare, die zur Lösung des Beitrags beigetragen haben
Content-ID: 252162
Url: https://administrator.de/forum/apache-server-vhost-datei-252162.html
Ausgedruckt am: 01.05.2025 um 23:05 Uhr
2 Kommentare
Neuester Kommentar
Mach einfach nen Redirect im HTTP vHost:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^/(.*) https://domain.tld/$1
</IfModule>
Redirect / https://domain.tld/
Den Part in IfModule kannst du auch einfach in ne .htaccess schmeißen ;)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^/(.*) https://domain.tld/$1
</IfModule>
Redirect / https://domain.tld/
Den Part in IfModule kannst du auch einfach in ne .htaccess schmeißen ;)