mydns installed, need to point each virtual host to the right DocumentRoot

Discussion in 'HOWTO-Related Questions' started by garbagedigger, Dec 11, 2007.

  1. garbagedigger

    garbagedigger New Member

    I'm trying the mydns panel and it is kind of working. I'm trying to figure out how to get each domain to go to the right DocumentRoot just like if you were to do virtual hosting in httpd.conf. Actually I kept each virtual host I had from my previous bind chroot configuration but I changed the namebasedhosts to and each virtual host to <Virtualhost> but still no luck. Each domain goes to the test page. Before, when I used bind chroot and I had my static ip with the port on the virtual hosts configuration mentioned above, it would go to the separate directories.

    Is there maybe some way to do all of this in mysql now?

    Here is example:

    NameVirtualHost (before when I used bind chroot, I just put my internet ip in and it worked. Now I have to use the localhost ip or "localhost" so I can log into mydnsconfig because everything is being traced back to the localhost.)

    ServerAdmin [email protected]
    DocumentRoot /var/www/example
    ServerName http://www.example.tld
    ServerAlias *
    ErrorLog logs/example__error_log
    CustomLog logs/example_access_log common
  2. falko

    falko Super Moderator ISPConfig Developer

    DNS is just for pointing to IP addresses, not to directories. You'd have to configure this in Apache - see
    Your ServerName is wrong - it must read
    ServerName www.example.tld
  3. garbagedigger

    garbagedigger New Member

    already removed the http://

    I tired that before and there was no luck. I decided to remove the http:// for good anyway since it seems irrelevant to have after reading the ServerName info at

    Now if I change the "NameVirtualHost," and "<VirtualHost>" directives to my internet static ip, the sites load to their correct directories. This method still prevents me from accessing mydnsconfig because the static ip is not associated with mydnsconfig, it is found locally. I was thinking maybe this is a good thing though because I can access mydnsconfig still at localhost/mydnsconfig. This way no one on the internet can even get to mydnsconig.

    I have tried localhost:80 as well and it didn't solve the problem.

    let me know what you think.

  4. falko

    falko Super Moderator ISPConfig Developer

    What IP addresses do you use in your Apache configuration, and what's the output of
    ? If you use, for example, that means that the site can be accessed from localhost only.
  5. garbagedigger

    garbagedigger New Member

    When you mean what address do I use in apache are you referring to the virtualhost IP? Right now I'm using my IP for virtual hosts but then I cannot access mydnsconfig unless I do it at localhost/mydnsconfig on the server. If I change the virtual hosts IP to, it stops using the document root somehow but I can get to my domains and with mydnsconfig.

    eth0 Link encap:Ethernet HWaddr 00:50:80:FB:17:17
    inet addr: Bcast: Mask:
    inet6 addr: fe80::250:80ff:fefb:1717/64 Scope:Link
    RX packets:63317 errors:0 dropped:0 overruns:0 frame:0
    TX packets:53413 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:21331277 (20.3 MiB) TX bytes:15278802 (14.5 MiB)
    Interrupt:16 Base address:0x2000

    lo Link encap:Local Loopback
    inet addr: Mask:
    inet6 addr: ::1/128 Scope:Host
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:21751 errors:0 dropped:0 overruns:0 frame:0
    TX packets:21751 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:13129687 (12.5 MiB) TX bytes:13129687 (12.5 MiB)
  6. falko

    falko Super Moderator ISPConfig Developer

    I'd try to use only in your Apache configuration.
    Is your server in a local network, i.e., the same network your client PC is in? Then you must make sure that your router supports loopbacks.
  7. garbagedigger

    garbagedigger New Member

    yeah, I tried that too. I've play with all sorts of combinations to be honest and only when I specify for each virtual host, does mydnsconfig come up but then each domain does not load to its proper document root!

    I started looking into this loopback thing you mentioned and I did a ping to on my server and it just kept doing this forever:

    PING ( 56(84) bytes of data.
    64 bytes from icmp_seq=1 ttl=64 time=0.033 ms
    64 bytes from icmp_seq=2 ttl=64 time=0.045 ms
    64 bytes from icmp_seq=3 ttl=64 time=0.047 ms
    64 bytes from icmp_seq=4 ttl=64 time=0.048 ms

    The only change was the seq value, which would increment by one and the ms value would vary but stay in a close range. I tired the same method with my static ip and it did the same thing.

    Anyway it would not give me a result and I thought it should

    So far I have a 5 port router with one static IP. I did specify the static ip to my server on one of the ports. I do have a wireless router connected to another port but it is found on a network. So I thought I should be good. I plan to get some more static ips soon and then I was going to give the wireless router its own static ip unless that does not make any sense.

    I also wanted to mention that phpMyAdmin works when I type it after any of my domains or nameserver/ip.

    Is there someway to tell mydns what IP or name server to use. I guess I didn't see anywhere to specify that when I set it up.
  8. falko

    falko Super Moderator ISPConfig Developer

    Can you post your Apache configuration?
  9. garbagedigger

    garbagedigger New Member

    Oh man, the answer was staring me in the face the whole time. I just realized tonight after looking through some of the mydnsconfig files that the actual php files that load up on the net for mydns are stored in /var/www/html/mydnsconfig by default. When I added the virtual hosts, httpd stopped looking in this directory because I keep the domains in /var/www/"example" hence mydnsconfig would not start up. Now what I did, is move the mydnsconfig directory to where one of my domains is and now I just have to type "mydnsconfig" after the domain name and BAM, it works.

    I also created a virtual host in httpd.conf for my name server and I pointed it to the default mydnsconfig directory. So now it can only be accessed if someone types my IP or before mydnsconfig. So there are different approaches to the situation.

    Here is a short virtual host example:

    <VirtualHost x.x.x.x:80>
    ServerName // I added the mydnsconfig after so if people still type just it will redirect to man domain I want to load up. //
    DocumentRoot /var/www/html/
    ErrorLog logs/ns1_error_log
    CustomLog logs/ns1_access_log common

    <VirtualHost x.x.x.x:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/example
    ServerAlias *
    ErrorLog logs/example__error_log
    CustomLog logs/example_access_log common

    Now I just need to setup the connection for mydns to use ssl and I'll be good to go!


    This may not be important to you, but I wanted to let you know that because of the alphabetized way programs startup when fedora boots, mydns tries to startup before mysql and this leads to some problems. I fixed this though.

    What I did is:
    When you enable this service at any run level it creates links in /etc/rc.d/rcN.d/ ("N" is the runlevel number) 
    called S98cups and K10cups
    All of the SnnXXXX files are executed in alphabetical order at startup.
    All the KxxXXXX files are executed in alpha-order at shutdown.
    2 digit nums are the rule, and generally the Snum and Knum sum to about 100 unless you have a reason otherwise.
    Talk about hacking the configuration for the service startup order.
    So I did: ls /etc/rc.d/rc5.d to view the contents of run level 5. I noticed S52mydns and an S64mysqld in the directory. Now this is a problem because mydns has a lower number so it boots before mysql.
    I also noticed there were some open values between S64 and S70. So I created a file S68mydns and I put the contents the S52mydns into S68mydns. Besides this, S52mydns had: # chkconfig: 345 52 50 inside the file but I changed it to 68. Even though it is commented out, I thought I would update for consistency. I did a reboot and it worked; mydns started after mysql.
    Here is the link to the thread on it in case you want to find out more on how I fixed this:

    Thanks again for everything and all the great information you and your team are putting fourth on the internet.
    Last edited: Dec 19, 2007

Share This Page