4

My goal is to host various sites (local virtualhosts) on my apache webserver in the LAN of my enterprise (Debian 9 server).

So that:

  • openproject.myenterprise.local => /opt/openproject
  • wiki.myenterprise.local => /var/www/location/wiki
  • etc.

I configured virtualhosts on my apache2 webserver with

  • /etc/apache2/sites-available/openproject.conf ServerName openproject.myenterprise.local
  • /etc/apache2/sites-available/000-main-static-site.conf ServerName vmDebDevSrv1.myenterprise.local ServerAlias salado.myenterprise.local
  • /etc/apache2/sites-available/001-wiki.conf ServerName wiki.myenterprise.local

Now its working with a local configuration in /etc/hosts

172.16.12.171 openproject.myenterprise.local
172.16.12.171 wiki.myenterprise.local

When I add the DNS resolution with bind9 it doesn't work anymore. I guess it is because of the incapacity of my server to relay the FQDN I use.

  • When I ping or put the url into my browser wiki it works but gives me the main directory of my webserver not the wiki virtualhost

Edit: ping wiki gives me:

ws1: ~$ ping wiki
PING ns1.myenterprise.local (172.16.10.174): 56 data bytes
64 bytes from 172.16.10.174: icmp_seq=0 ttl=64 time=0.282 ms
^C--- ns1.myenterprise.local ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.282/0.325/0.368/0.043 ms

/edit

  • When I ping wiki.myenterprise.local it doesn't work ping: unknown host, Edit: nslookup works with FQDN /Edit

My /etc/resolv.conf

domain myenterprise.local
search myenterprise.local
nameserver 172.16.12.174
nameserver 172.16.12.1
nameserver ...

/etc/bind/db.myenterprise.local

$TTL|   604800
@|      IN|     SOA|    ns1.myenterprise.local. root.vmDebDevSrv1.myenterprise.local. (
|       |       |       20181129|       ; Serial
|       |       |        604800||       ; Refresh
|       |       |         86400||       ; Retry
|       |       |       2419200||       ; Expire
|       |       |        604800 )|      ; Negative Cache TTL

;Name server information
@|      IN|     NS|     ns1.myenterprise.local.

;IP Address of Domain Name Server(DNS) setted on line above
ns1|    IN|     A|      172.16.12.174

;CNAME Records
vmDebDevSrv1|   IN|     CNAME|  ns1.myenterprise.local.
wiki|   IN|     CNAME|  vmDebDevSrv1.myenterprise.local.
openproject|    IN|     CNAME|  vmDebDevSrv1.myenterprise.local.

;tried too with 
;wiki|   IN|     A  172.16.12.174
;openproject|   IN|     A  172.16.12.174

What Am I missing?!!! I thought the path would be short-name=>DNS=>FQDN=>Apache2=>well page returned

So I guess its impossible to get

Philippe Gachoud
  • 1,517
  • 15
  • 20
  • 2
    Do you have a `search domain` in your `/etc/resolv.conf` ? That can affect the `hostname` -> `hostname.domain` conversion – ivanivan Nov 13 '18 at 16:46
  • @ivanivan yes thx, edited the question. – Philippe Gachoud Nov 13 '18 at 16:54
  • 1
    Lot's of info on your apache config. What about details on your DNS config and resolution? – Tommiie Nov 13 '18 at 17:55
  • @Tom edited thx, tell me if there is a need for more... – Philippe Gachoud Nov 13 '18 at 18:05
  • if I read it correctly, the configuration with the CNAME will default to the default site, dir you reload the bind9 server after trying with the IN records (and removed the CNAME?)? after you do the change check with dig what you will get fir wiki/openproject. – Zina Nov 13 '18 at 20:21
  • You have two name servers. What server is using IP address 172.16.12.1? This might be causing some of the problems you're facing. – Tommiie Nov 14 '18 at 11:59
  • @Tom 172.16.12.1 is the internet router direction so if my DNS server is down the network still works... – Philippe Gachoud Nov 14 '18 at 12:36
  • But can your internet router also resolve those `myenterprise.local` names? – Tommiie Nov 14 '18 at 12:37
  • @Tom nope, having to duplicate these entries is not in my goal, maybe I'm wrong with my practices in which case you could point me out some documentation – Philippe Gachoud Nov 14 '18 at 12:45

1 Answers1

3

When I ping or put the url into my browser wiki it works but gives me the main directory of my webserver not the wiki virtualhost.

When you only enter wiki in your browser window, I would say that even though the OS adds the search domains when trying to perform a DNS lookup, the Host header sent in the HTTP request is just what you've put in the browser window, i.e. Host: wiki. To make that work, put in a ServerAlias wiki in your Apache configuration.

When I ping wiki.myenterprise.local it doesn't work.

Can you paste the output of your ping commands? Some troubleshooting steps to consider:

  • Can you resolve your FQDNs? Please provide proof that you can.
  • Can you resolve using only the host names, i.e. is the search domain correctly being applied to your DNS queries? Please provide proof that you can.
  • Do they all resolve to the correct IP address(es)? Please provide proof.
  • If ping doesn't work, check your routing and firewall rules.
Tommiie
  • 5,547
  • 2
  • 11
  • 45
  • Thx! `nslookup wiki.myenterprise.local Server: 172.16.10.174 Address: 172.16.10.174#53 wiki.myenterprise.local canonical name = vmDebDevSrv1.myenterprise.local. vmDebDevSrv1.myenterprise.local canonical name = ns1.myenterprise.local. Name: ns1.myenterprise.local Address: 172.16.10.174` – Philippe Gachoud Nov 14 '18 at 11:31
  • `ping wiki.myenterprise.local ping: unknown host` – Philippe Gachoud Nov 14 '18 at 11:31
  • `ping wiki PING ns1.myenterprise.local (172.16.10.174): 56 data bytes 64 bytes from 172.16.10.174: icmp_seq=0 ttl=64 time=0.282 ms 64 bytes from 172.16.10.174: icmp_seq=1 ttl=64 time=0.368 ms ^C--- ns1.myenterprise.local ping statistics --- 2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max/stddev = 0.282/0.325/0.368/0.043 ms` – Philippe Gachoud Nov 14 '18 at 11:32
  • `put in a ServerAlias wiki` did the trick! – Philippe Gachoud Nov 14 '18 at 12:37