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>
Please also mark the comments that contributed to the solution of the article
Content-Key: 252162
Url: https://administrator.de/contentid/252162
Printed on: April 24, 2024 at 04:04 o'clock
2 Comments
Latest comment
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 ;)