Hello everyone ! I'm tring to set virtualhosts in apache2. In apache2.conf, I set : ServerName mylocalIP NameVirtualHost * I've made a first virtualhost like this : <VirtualHost *> ServerName webmail.mydomain.tld # Indexes + Directory Root. DirectoryIndex index.php DocumentRoot /var/www/webmail/ # Logfiles ErrorLog /var/log/apache2/webmail/error.log CustomLog /var/log/apache2/webmail/access.log combined </VirtualHost> Code (markup): I've made a second virtualhost like this : <VirtualHost *> ServerName phpbb.mydomain.tld # Indexes + Directory Root. DirectoryIndex index.php DocumentRoot /var/www/phpbb/ # Logfiles ErrorLog /var/log/apache2/phpbb/error.log CustomLog /var/log/apache2/phpbb/access.log combined </VirtualHost> Code (markup): I did a a2ensite webmail + a2ensite phpbb + apache2 reload. To test, I use a computer out of my network : - When I go to "webmail.mydomain.tld", I see my webmail -> OK - When I go to "phpbb.mydmain.tld", I see my webmail -> Not OK - When I go to "mydomain.tld", I see my webmail -> Not OK - When I go to "something.mydmain.tld", I see my webmail -> Not OK "something.mydomain.tld" isn't a virtualhost I created, it doesn"t exists. Question are how to make : - "webmail.mydmain.tld" goes to /var/www/webmail/ - "mydmain.tld" goes to /var/www/ - "something.mydmain.tld" goes to /var/www/ ? Thanks a lot
Why will you see Webmail for the above 3 URLs, if their DocumentRoot is not pointing to /var/www/webmail/ ? They should point to their own DocumentRoot. BTW, make sure the A record for phpbb.mydmain.tld and mydmain.tld is set to your server IP. And a wildcard DNS record set to point to mydmain.tld. You need to add the VirtualHost entry for each of the URL you are trying to access including *.mydomain.tld for something.mydomain.tld to work. Make sure you set an A record for all the sub-domains including wirld-card i.e. * to point to your server IP. The entry should be placed in the DNS zone of the mydomain.tld file.
Okay, and in the Bind conf file, must I specify my LAN IP adress, or my WAN IP adress ? Actually, all my Bind conf file is configured with LAN IP adress (192.168.x.x) Thanks a lot
You should specify the WAN IP address in the DNS zone files. Make sure you have WAN IP address for all the entires of a domain. LAN IP won't do...
Hello, First, thanks for your replies, it was very helpful for me. I set my subdomains in my Bind configuration : this is more efficient this way...lol. I don't use my WAN IP, my Bind server is also used on my LAN, it works like this, do you judge I must use my WAN IP ? My server is behind a router and I forward 80 traffic to my LAN IP server ? Wait and see, it's not important at the moment, it works... I got a new problem now, with another kind of VirtualHost. I must make a redirection with apache to another server by the port 80 with this Virtualhost config : <VirtualHost *> ServerName glpi.mydomain.tld <Proxy *> Order deny,allow Allow from all </Proxy> RewriteEngine on ProxyPass / http://192.168.x.x/glpi/ ProxyPassReverse / http://192.168.x.x/glpi/ # Logfiles ErrorLog /var/log/apache2/glpi/error.log CustomLog /var/log/apache2/glpi/access.log combined </VirtualHost> Code (markup): I activate "RewiteEngine", "Proxypass", "ProxyPassReverse" modules, and on my LAN, when I type http://192.168.x.x/phpbb it works. When I try to go to glpi.mydmain.tld, it doesn't display pictures, I got text, but no pictures. I repeat I works fine on my LAN. I do the same kind of VirtualHost with phpbb and I works from the WAN. Is there a module to activate or something ? Thanks a lot !