Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [Virtual hosts] 2 różne domeny na jedynm ip
Forum PHP.pl > Forum > Serwery WWW > Apache
zielq701
Witam wszystkich,
posiadam serwer dedykowany, dokupiłem drugą domenę z myślą podpięcia do niej drugiej, innej strony www. Niestety już za dużo nerwów na to straciłem, dlatego piszę tutaj.

Nie wiem czy wina leży po stronie apache, czy pomieszałem coś w bindzie. Dodałem 2 domenę (tutaj będzie to superexample.pl), tylko że nie wczytuje mi strony z tego katalogu, a przekierowuje to na https:// cloud.otherexample.net. A gdy np. wpiszę w pasku adresu smtp.otherexample.net (którego nie ma w virtual hostach), wtedy pokazuje mi zawartość katalogu, który powinien być pod superexample.pl co_jest.gif .

Z jedną domeną wszystko działało jak chciałem, a teraz coś jest porypane, męcze to już kolejny dzień i brak efektów. Proszę aby ktoś rzucił na to okiem, bo ja mam już zaćmienie umysłu całkowite. Pewnie odpowiedź jest prosta. Niżej załączam konfigurację virtualhostów.

  1. # superexample.pl
  2.  
  3. <VirtualHost *:80>
  4. DocumentRoot /home/zielu/domains/superexample.pl/public_html
  5.  
  6. ServerName www.superexample.pl
  7. ServerAlias superexample.pl *.superexample.pl
  8.  
  9. <Directory /home/zielu/domains/superexample.pl/public/>
  10. Options -Indexes
  11. AllowOverride All
  12. Order allow,deny
  13. allow from all
  14. </Directory>
  15.  
  16.  
  17. # Logfiles
  18. ErrorLog /home/zielu/domains/superexample.pl/logs/error.log
  19. CustomLog /home/zielu/domains/superexample.pl/logs/access.log combined
  20. </VirtualHost>
  21.  
  22. # otherexample.net
  23.  
  24. <VirtualHost *:80>
  25. ServerName www.otherexample.net
  26. ServerAlias otherexample.net
  27.  
  28. RewriteEngine On
  29. RewriteCond %{HTTPS} off
  30. RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
  31. </VirtualHost>
  32.  
  33. <VirtualHost *:443>
  34. ServerName otherexample.net
  35. ServerAlias www.otherexample.net
  36.  
  37. RewriteEngine On
  38. RewriteCond %{HTTPS} off
  39. RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
  40.  
  41. # Indexes + Directory Root.
  42. DirectoryIndex index.html index.php
  43. DocumentRoot /home/zielu/domains/otherexample.net/private_html
  44.  
  45. SSLEngine on
  46. SSLProtocol all -SSLv2
  47. SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
  48.  
  49. SSLCertificateFile /etc/apache2/ssl/ssl.crt
  50. SSLCertificateKeyFile /etc/apache2/ssl/private.key
  51. SSLCertificateChainFile /etc/apache2/ssl/sub.class1.server.ca.pem
  52.  
  53. <Directory /home/www/ftp/domains/otherexample.net/private_html/>
  54. Options -Indexes
  55. AllowOverride All
  56. Order allow,deny
  57. allow from all
  58. </Directory>
  59.  
  60. Alias /gitlist /opt/www/gitlist
  61. <Directory /opt/www/gitlist>
  62. Options -Indexes
  63. AllowOverride All
  64. Order allow,deny
  65. allow from all
  66. </Directory>
  67.  
  68. # CGI Directory
  69. ScriptAlias /cgi-bin/ /home/zielu/domains/otherexample.net/cgi-bin
  70. <Location /cgi-bin>
  71. Options +ExecCGI
  72. </Location>
  73.  
  74.  
  75. # Logfiles
  76. ErrorLog /home/zielu/domains/otherexample.net/logs/error.log
  77. CustomLog /home/zielu/domains/otherexample.net/logs/access.log combined
  78.  
  79. </VirtualHost>
  80.  
  81. #cloud.otherexample.net
  82.  
  83. <VirtualHost *:80>
  84. ServerName cloud.otherexample.net
  85.  
  86. RewriteEngine On
  87. RewriteCond %{HTTPS} off
  88. RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
  89.  
  90. </VirtualHost>
  91.  
  92. <VirtualHost *:443>
  93.  
  94. DocumentRoot /opt/www/owncloud
  95. ServerAdmin patryk@otherexample.net
  96. ServerName cloud.otherexample.net
  97.  
  98. SSLEngine on
  99. SSLProtocol all -SSLv2
  100. SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
  101.  
  102. SSLCertificateFile /etc/apache2/ssl/ssl.crt
  103. SSLCertificateKeyFile /etc/apache2/ssl/private.key
  104. SSLCertificateChainFile /etc/apache2/ssl/sub.class1.server.ca.pem
  105.  
  106. # Indexes + Directory Root.
  107. DirectoryIndex index.html index.php
  108.  
  109. <Directory /opt/www/owncloud/>
  110. Options -Indexes
  111. AllowOverride All
  112. Order allow,deny
  113. allow from all
  114. </Directory>
  115.  
  116. # CGI Directory
  117. ScriptAlias /cgi-bin/ /opt/www/owncloud/cgi-bin
  118. <Location /cgi-bin>
  119. Options +ExecCGI
  120. </Location>
  121.  
  122. </VirtualHost>
  123.  
  124.  
  125. # mail.otherexample.net
  126.  
  127. <VirtualHost *:80>
  128. ServerName mail.otherexample.net
  129.  
  130. RewriteEngine On
  131. RewriteCond %{HTTPS} off
  132. RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
  133. </VirtualHost>
  134.  
  135. <VirtualHost *:443>
  136.  
  137. ServerAdmin patryk@otherexample.net
  138. ServerName mail.otherexample.net
  139.  
  140. DocumentRoot /opt/www/roundcubemail
  141.  
  142. SSLEngine on
  143.  
  144. SSLCertificateFile /etc/apache2/ssl/mail.otherexample.net.crt
  145. SSLCertificateKeyFile /etc/apache2/ssl/mail.otherexample.net.nopass.key
  146. SSLCertificateChainFile /etc/apache2/ssl/mail.cacert.pem
  147.  
  148. Alias /vimbadmin /opt/www/vimbadmin/public
  149.  
  150. <Directory /opt/www/vimbadmin/public>
  151. Options FollowSymLinks
  152. AllowOverride None
  153.  
  154. # For Apache <= 2.3:
  155. Include /etc/apache2/deny.conf
  156.  
  157. # For Apache >= 2.4
  158. # Require all granted
  159.  
  160. SetEnv APPLICATION_ENV production
  161.  
  162. RewriteEngine On
  163. RewriteCond %{REQUEST_FILENAME} -s [OR]
  164. RewriteCond %{REQUEST_FILENAME} -l [OR]
  165. RewriteCond %{REQUEST_FILENAME} -d
  166. RewriteRule ^.*$ - [NC,L]
  167. RewriteRule ^.*$ /vimbadmin/index.php [NC,L]
  168. </Directory>
  169.  
  170. </VirtualHost>
  171.  
Mlodycompany
Wykonaj ping na obydwie domeny, jeśli adres IP jest w obydwóch przypadkach taki sam to nie jest to wina binda, tylko apacha. W takim przypadku na pewno posortuj virtualne hosty w kolejności od najgłębszego, czyli najpierw cloud.otherexample.pl, a później otherexpamle.pl.
zielq701
Cytat(Mlodycompany @ 29.05.2015, 08:41:51 ) *
Wykonaj ping na obydwie domeny, jeśli adres IP jest w obydwóch przypadkach taki sam to nie jest to wina binda, tylko apacha. W takim przypadku na pewno posortuj virtualne hosty w kolejności od najgłębszego, czyli najpierw cloud.otherexample.pl, a później otherexpamle.pl.


Ping - OK. Posortowanie nic nie dało :/

apache2ctl -S , zwraca:

  1. VirtualHost configuration:
  2. wildcard NameVirtualHosts and _default_ servers:
  3. *:443 is a NameVirtualHost
  4. default server cloud.otherexample.net (/etc/apache2/sites-enabled/vhosts:12)
  5. port 443 namevhost cloud.otherexample.net (/etc/apache2/sites-enabled/vhosts:12)
  6. port 443 namevhost mail.otherexample.net (/etc/apache2/sites-enabled/vhosts:54)
  7. port 443 namevhost otherexample.net (/etc/apache2/sites-enabled/vhosts:102)
  8. *:80 is a NameVirtualHost
  9. default server cloud.otherexample.net (/etc/apache2/sites-enabled/vhosts:3)
  10. port 80 namevhost cloud.otherexample.net (/etc/apache2/sites-enabled/vhosts:3)
  11. port 80 namevhost mail.otherexample.net (/etc/apache2/sites-enabled/vhosts:46)
  12. port 80 namevhost www.otherexample.net (/etc/apache2/sites-enabled/vhosts:93)
  13. port 80 namevhost www.superexample.pl (/etc/apache2/sites-enabled/vhosts:153)
  14. Syntax OK


--------------
Przed chwilą wykomentowałem całkowicie cloud.otherexample.net i dzieje się coś dziwnego, dalej przekierowuje mnie na ten adres ohno-smiley.gif . Wychodzę z siebie już wacko.gif .

--------------
Znalazłem przyczynę. Zacząłem się zastanawiać czy to nie wina czegoś innego, sprawdziłem na innej przeglądarce i działa.... Przeglądarka, której używam wrzuciła stare przekierowania do cache, po wyczyszczeniu zaczęło działać.
Nawet nie wiedziałem, że to sie cachuje i przez to straciłem naprawdę dużo czasu thumbsdownsmileyanim.gif . Problem rozwiązany, a w sumie to brak problemu... blink.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2024 Invision Power Services, Inc.