Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > HOWTO-Related Questions

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 11th December 2007, 02:39
garbagedigger garbagedigger is offline
Junior Member
 
Join Date: Dec 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Question mydns installed, need to point each virtual host to the right DocumentRoot

I'm trying the mydns panel and it is kind of working. I'm trying to figure out how to get each example.com 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 127.0.0.1:80 and each virtual host to <Virtualhost 127.0.0.1:80> 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 127.0.0.1:80 (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.)

<VirtualHost 127.0.0.1:80>
ServerAdmin myname@example.com
DocumentRoot /var/www/example
ServerName http://www.example.tld
ServerAlias example.com *.example.com
ErrorLog logs/example__error_log
CustomLog logs/example_access_log common
</VirtualHost>
Reply With Quote
Sponsored Links
  #2  
Old 11th December 2007, 14:44
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,721 Times in 2,562 Posts
Default

Quote:
Originally Posted by garbagedigger
I'm trying the mydns panel and it is kind of working. I'm trying to figure out how to get each example.com 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 127.0.0.1:80 and each virtual host to <Virtualhost 127.0.0.1:80> 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.
DNS is just for pointing to IP addresses, not to directories. You'd have to configure this in Apache - see http://httpd.apache.org/docs/2.2/vhosts/name-based.html
Quote:
Originally Posted by garbagedigger
<VirtualHost 127.0.0.1:80>
ServerAdmin myname@example.com
DocumentRoot /var/www/example
ServerName http://www.example.tld
ServerAlias example.com *.example.com
ErrorLog logs/example__error_log
CustomLog logs/example_access_log common
</VirtualHost>
Your ServerName is wrong - it must read
Code:
ServerName www.example.tld
instead.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 12th December 2007, 03:05
garbagedigger garbagedigger is offline
Junior Member
 
Join Date: Dec 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation 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 httpd.apache.org

Now if I change the "NameVirtualHost," and "<VirtualHost>" directives to my internet static ip, the example.com 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.

Thanks
Reply With Quote
  #4  
Old 13th December 2007, 17:39
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,721 Times in 2,562 Posts
Default

What IP addresses do you use in your Apache configuration, and what's the output of
Code:
ifconfig
? If you use 127.0.0.1, for example, that means that the site can be accessed from localhost only.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 13th December 2007, 21:39
garbagedigger garbagedigger is offline
Junior Member
 
Join Date: Dec 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation

When you mean what address do I use in apache are you referring to the virtualhost IP? Right now I'm using my 75.146.177.61 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 127.0.0.1, 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:75.146.177.61 Bcast:75.146.177.63 Mask:255.255.255.252
inet6 addr: fe80::250:80ff:fefb:1717/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
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:127.0.0.1 Mask:255.0.0.0
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)
Reply With Quote
  #6  
Old 14th December 2007, 13:15
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,721 Times in 2,562 Posts
Default

I'd try to use only 75.146.177.61 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.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #7  
Old 14th December 2007, 18:59
garbagedigger garbagedigger is offline
Junior Member
 
Join Date: Dec 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yeah, I tried that too. I've play with all sorts of combinations to be honest and only when I specify 127.0.0.1 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 127.0.0.1 on my server and it just kept doing this forever:

PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.033 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.045 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.047 ms
64 bytes from 127.0.0.1: 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 10.1.10.1 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.
Reply With Quote
  #8  
Old 15th December 2007, 16:30
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,721 Times in 2,562 Posts
Default

Can you post your Apache configuration?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #9  
Old 19th December 2007, 02:24
garbagedigger garbagedigger is offline
Junior Member
 
Join Date: Dec 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

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 ns1.example.com before mydnsconfig. So there are different approaches to the situation.

Here is a short virtual host example:

<VirtualHost x.x.x.x:80>
ServerName ns1.example.com/mydnsconfig // I added the mydnsconfig after ns1.example.com so if people still type just ns1.example.com 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>

<VirtualHost x.x.x.x:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/example
ServerName www.example.com
ServerAlias example.com *.example.com
ErrorLog logs/example__error_log
CustomLog logs/example_access_log common
</VirtualHost>


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:
Code:
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:

http://fedoraforum.org/forum/showthread.php?t=175164

Thanks again for everything and all the great information you and your team are putting fourth on the internet.

Last edited by garbagedigger; 19th December 2007 at 03:11.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix problem: lost connection after CONNECT from unknown fernando_torrez Server Operation 5 30th November 2007 14:17
ISPConfig DNS and virtual host configuration tips and problem Ripper Installation/Configuration 6 26th June 2007 00:29
This is %#@*&^$# embarrassing! domino Smalltalk 34 5th February 2007 21:57
ISPConfig adds two DocumentRoot to a virtual host cryptic General 3 9th November 2006 09:56
I broke it.. I think.. Email in is not being delivered? edge Server Operation 1 3rd July 2006 14:22


All times are GMT +2. The time now is 10:13.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.