ubuntuusers.de

Server & VHOST

Status: Ungelöst | Ubuntu-Version: Ubuntu 18.04 (Bionic Beaver)
Antworten |

stray-devils

Anmeldungsdatum:
23. Juni 2019

Beiträge: Zähle...

Hallo liebe Community,

ich kämpfe als Neuling mit der konfiguration eines Linux Server (Ubuntu). Nach 4 Tagen des kämpfens und viel lesen läuft das Ding jetzt. Bei der Konfiguration des vhost verzweifel ich langsam.

Ich habe 2 Domains (domain-1 & domain-2) und der Server hat eine IP-Adresse (213.050.11.190). Beide Domains zeigen via A-Record auf die IP-Adresse 213.050.11.190. Jetzt muss ich es irgendwie hin bekommen, das ich auf dem Server mehrere Webseiten betreiben kann.

Beim Aufruf der beiden Domains wird aktuell aber der selbe Inhalt angezeigt.

Was mache ich FALSCH?

Hoffe mir kann einer helfen. 😉

Gruß stray-devil


mkdir -p /var/www/html/domain-1_de


joe /etc/apache2/sites-available/domain-1_de.conf


<VirtualHost 213.050.11.190:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        
	ServerName domain-1.de

        ServerAdmin admin@irgendeine-domain.mobi
        DocumentRoot /var/www/html/domain-1_de/wordpress

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/domain-1_de_error.log	
        CustomLog ${APACHE_LOG_DIR}/domain-1_de_access.log combined	

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with ""a2disconf"".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

a2ensite domain-1_de.conf

joe /etc/apache2/sites-available/www_domain-1_de_de.conf


<VirtualHost 213.050.11.190:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        
	ServerName www.domain-1_de.de

        ServerAdmin admin@irgendeine-domain.mobi
        DocumentRoot /var/www/html/domain-1_de_de/wordpress

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/domain-1_de_error.log	
        CustomLog ${APACHE_LOG_DIR}/domain-1_de_access.log combined	

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with ""a2disconf"".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>


a2ensite www_domain-1_de.conf


Bearbeitet von redknight:

Forensyntax eingefügt

Moderiert von redknight:

Verschoben.

MelcooX

Anmeldungsdatum:
26. April 2016

Beiträge: 144

Wohnort: Am Ende des Weges

Hallo stray-devils

Da du Neuling in der Serveradministration bist: Sicherheit & Sicherheits-Einmaleins/Server (Meiner Erfahrung nach, wirst du noch über einige Problem stolpern...)

Aber nun zu deinem Problem: Du hast bis jetzt "nur" zwei Konfigurationsdateien geteilt, die erste von der Domain: domain-1.de und die zweite von www.domain-1_de.de

Ich sage mal ein Fehler liegt da bei den Servernamen der zweiten Datei, denn der scheint ein wenig komisch zu sein... Und wie sieht es mit den Rechten aus der Ordner? Und was sagt der Configtest von apache2? Desweiteren: Hast du den Apache Server am Ende neu gestartet, denn du hast dies nicht erwähnt?

Und noch so einen kleinen Tipp: Da du noch im Aufbau bist, lohnt es sich die Konfiguration so zu ändern, dass du http direkt auf https weiterleitest und alles direkt mit HTTPS aufsetzt, da der Wechsel von HTTP mühsamer ist, als das direkte aufsetzen von HTTPS...

MFG

TheNexus

Anmeldungsdatum:
30. Juni 2019

Beiträge: Zähle...

Antworten |