NetVision-Technik

NetVision-Technik (http://www.netvision-technik.de/forum/index.php)
-   Webserver (http://www.netvision-technik.de/forum/forumdisplay.php?f=9)
-   -   vhost/hostname config problem (http://www.netvision-technik.de/forum/showthread.php?t=7582)

Bl@ck-Ripper™ 26.11.2017 15:26

vhost/hostname config problem
 
Ich weiß gerade nicht warum aber es geht nicht :/

Ich will einen server umzug machen allerdings geht die config nicht und ich weiß nicht warum

Ich habe einen neuen dedizierten server mit debian 8 frisch installiert mit apache2 php7 ect.
Problem
Klicke hier, um den gesamten Text zu sehen

meine vhost config ist so ( 000-default.conf)
Code:

<VirtualHost xxx.xx.xx.xxx:80>

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined


</VirtualHost>

<VirtualHost url-von-dyndns.istmein.de:80>
   
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/neu

        ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

   
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Wenn ich auf die ip gehe komme ich auf den ordner html.
wenn ich auf die url gehe komme ich auf den ordner neu

So soll es sein.

Wenn ich jetzt aber eine domain bzw. cloudflare nutzen möchte bsp
Code:

<VirtualHost xxx.xx.xx.xxx:80>

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined


</VirtualHost>

<VirtualHost meineurl.endung:80>
   
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/neu

        ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

   
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

komme ich wenn ich auf die ip gehe auf den Ordner html.
wenn ich auf die url gehe komme ich auf den Ordner html.

So soll es nicht sein.

Die domain ist bei namecheap. dort habe ich bei nameservers coustom dns gemacht und
xxx.xx.cloudflare.com und
xx1.xx.cloudflare.com eingetragen.
Bei cloudflare den dns einstellungen habe ich stehen
Code:

Type  Name                          Value                                  TTL 

 A  meineurl.endung            points to xxx.xx.xx.xxx    Automatic   
   
A      www                          points to xxx.xx.xx.xxx    Automatic

auf meinem root habe ich in der hostname
Code:

xxxxxnamevomserverxxx
xxx.xx.cloudflare.com
xx1.xx.cloudflare.com

wo liegt der fehler ?

Das komnische, so habe ich es auf meinem alten root auch und es geht.

Der einzige unterschied liegt darin das der alte root ein japanischer server ist und der neue einer in usa.



____________ ADD : 28.11.2017 ______Lösung__
Seit Debian 8 kann es vorkommen das jede vhost eine eigene .conf brauch. Hier die Lösung

  • 000-default.conf = Leer (muss aber da sein)
  • default-ssl.conf = Leer (muss aber da sein)
  • 001-default-rutorrent.conf = Fals ihr einen rTorrent laufen lassen wollt öegt er die datei an. die einfach so lassen oder ggf ServerName in eine url ändern)
  • ip-1.conf = einstellungen für die IP
  • ip-1-ssl.conf = einstellungen für die IP (https)
  • url1.conf = einstellungen für die Domain
  • url1-ssl.conf = einstellungen für die Domsin (https)
  • usw.
  • Wichtig für jede ip/Domain eine eigene Config erstellen
so könnte es sehen bsp.
ip-1.conf
Code:

<VirtualHost xxx.ip.vom.server:80>
        ServerName xxx.ip.vom.server       
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

url-1.conf
Code:

<VirtualHost xxx.ip.vom.server:80>
        ServerName domain.endung   
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/ordnerx/yz/
        <Directory /var/www/ordnerx/yz/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

für ssl könnte es aussehen (kommt drauf an was ihr für win ssl (bsp. opensssl) nehmt


url-1-ssl.conf
Code:

<virtualhost xxx.ip.vom.server:443>
        ServerName domain.endung
        SSLEngine On
        SSLCertificateFile /usr/share/ca-certificates/mozilla/euercertificat.crt
        DocumentRoot /var/www/ordnerx/yz/
 </virtualhost>


Wichtig jede config muss aktiviert werden. (das.conf kan dabei weggelassen werden)


Code:

a2ensite ip-1
a2ensite ip-1-ssl
a2ensite url-1
a2ensite url-1-ssl

usw.

danach einfach neustarten (bsp. /etc/init.d/apache2 restart ) Fertig

D@rk-€vil™ 26.11.2017 18:16

Wenn dann so

Code:

<VirtualHost *:80>
        ServerName blabla.de
        ServerAlias blabla.de
        DocumentRoot /home/deinordner
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


Bl@ck-Ripper™ 26.11.2017 18:39

ist egal ist das selbe problem.

pat 26.11.2017 19:57

pfade alle nachgeschaut?
schau mal in deine config !

Bl@ck-Ripper™ 27.11.2017 17:30

000-default.conf (mit ip/url oder * ist egal )
Code:

<VirtualHost xx.xx.xx.xx:80>   

    ServerName xx.xx.xx.xx
    ServerAlias xx.xx.xx.xx
 
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

</VirtualHost>

<VirtualHost url.endung:80>

      ServerName url.endung
      ServerAlias url.endung

      ServerAdmin webmaster@localhost
      DocumentRoot /var/www/html/neu

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

default-ssl.conf
Code:

<IfModule mod_ssl.c>
    <VirtualHost _default_:443>
        ServerAdmin webmaster@localhost
                DocumentRoot /var/www/html
                SSLEngine on
                SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
        SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

        <FilesMatch "\.(cgi|shtml|phtml|php)$">
                SSLOptions +StdEnvVars
        </FilesMatch>
        <Directory /usr/lib/cgi-bin>
                SSLOptions +StdEnvVars
        </Directory>

    </VirtualHost>
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

apache2.conf
Code:


DefaultRuntimeDir ${APACHE_RUN_DIR}

PidFile ${APACHE_PID_FILE}

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 5

User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

HostnameLookups Off

ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

#<Directory /srv/>
#    Options Indexes FollowSymLinks
#    AllowOverride None
#    Require all granted
#</Directory>

AccessFileName .htaccess

<FilesMatch "^\.ht">
    Require all denied
</FilesMatch>

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

IncludeOptional conf-enabled/*.conf

IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

ports.conf
Code:

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 80

<IfModule ssl_module>
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

mehr wüsste ich jetzt nicht.

bei eingabe der ip kommt man auf den ordner html (so soll es sein)
bei eingabe der url kommt man auf den ordner html (soll aber auf neu kommen)

Und jetzt das Kuriose.

wemm uch die 000-def ändere in
Code:

<VirtualHost xxx.xxx.xxx.xx:80>   

    ServerName xxx.xxx.xxx.xx
    ServerAlias xxx.xxx.xxx.xx
 
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

</VirtualHost>


<VirtualHost url.endung:80>

      ServerName url.endung
      ServerAlias url.endung

      ServerAdmin webmaster@localhost
      DocumentRoot /var/www/html/neu

</VirtualHost>

<VirtualHost urlvondyndns.istmein.de:80>

      ServerName urlvondyndns.istmein.de
      ServerAlias urlvondyndns.istmein.de

      ServerAdmin webmaster@localhost
      DocumentRoot /var/www/html/neu2

</VirtualHost>

Komme ich wenn ich die ip eingeba auf : html
bei der url (von dyn.com) auf : neu2
bei der normalen url auf : html statt auf neu

irgendwie verstehe ich das gerade nicht :/

an dem domain hoster bzw. cloudflare kann es ja eigentlich nicht liegen, da die domain ja uf die ip leitet



--======================================--
--==
Beitrag erstellt: 18:30 um 23:25 ==--
--==
geantwortet 27.11.2017 auf Beitrag vom 26.11.2017 ==--
--== automatische Beitragszusammenführung ==--
--======================================--


Bl@ck-Ripper™ schrieb nach 19 Stunden, 4 Minuten und 48 Sekunden:

ADD :

wenn ich mache

(http://) ip = html Ordner
(https://) ip = html Ordner (muss zertifika bestätigen da selbst signiert)
ist auch richtig so

(http://) urlvondyndns.istmein.de = neu2 Ordner
(https://) urlvondyndns.istmein.de = html Ordner (muss certifikat bestätigen da selbst signiert)
Warum wird bei https auf html umgeleitet ??

(http://) domain.endung = html Ordner
(https://) domain.endung = html Ordner (certifikat muss nicht bestätigt werden da signiert)
Soweit ok nur soll es nicht ins html Ordner gehen sondern ins neu Ordner

von mir aus kann auch von der domain.endung in html gehen und mit der ip in ein anderes.
Hab ich per .ht probiert aber funktioniert auch nicht.

So langsam weiß ich auch nicht mehr weiter :/

Waiti 27.11.2017 18:07

*edit*
ups sorry, hatter ja geändert

Bl@ck-Ripper™ 28.11.2017 13:07

Problem Gelöst :) wenn noch einer das problem hat, insbesondere mit mehr ip's /urls.
(Ich poste es in mein startpost)

  • 000-default.conf = Leer (muss aber da sein)
  • default-ssl.conf = Leer (muss aber da sein)
  • 001-default-rutorrent.conf = Fals ihr einen rTorrent laufen lassen wollt öegt er die datei an. die einfach so lassen oder ggf ServerName in eine url ändern)
  • ip-1.conf = einstellungen für die IP
  • ip-1-ssl.conf = einstellungen für die IP (https)
  • url1.conf = einstellungen für die Domain
  • url1-ssl.conf = einstellungen für die Domsin (https)
  • usw.
  • Wichtig für jede ip/Domain eine eigene Config erstellen
so könnte es sehen bsp.
ip-1.conf
Code:

<VirtualHost xxx.ip.vom.server:80>
        ServerName xxx.ip.vom.server       
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

url-1.conf
Code:

<VirtualHost xxx.ip.vom.server:80>
        ServerName domain.endung   
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/ordnerx/yz/
        <Directory /var/www/ordnerx/yz/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

für ssl könnte es aussehen (kommt drauf an was ihr für win ssl (bsp. opensssl) nehmt


url-1-ssl.conf
Code:

<virtualhost xxx.ip.vom.server:443>
        ServerName domain.endung
        SSLEngine On
        SSLCertificateFile /usr/share/ca-certificates/mozilla/euercertificat.crt
        DocumentRoot /var/www/ordnerx/yz/
 </virtualhost>


Wichtig jede config muss aktiviert werden. (das.conf kan dabei weggelassen werden)


Code:

a2ensite ip-1
a2ensite ip-1-ssl
a2ensite url-1
a2ensite url-1-ssl

usw.

danach einfach neustarten (bsp. /etc/init.d/apache2 restart ) Fertig


Alle Zeitangaben in WEZ +1. Es ist jetzt 17:39 Uhr.

Powered by vBulletin® Version 3.8.9 (Deutsch)
Copyright ©2000 - 2024, vBulletin Solutions, Inc.