Multi-Domains on Home Web Server - DNS issues?

so you created a domain with mod_fcgid and the /home/mydomain.us was created?
suexec points to /home?
other created domains are also in the /home directory?
how come those doesn’t resolve yet as you had them pointing to your server before?

if installation went flawless then default settings should produce a working system.
you need to look into the httpd.conf - section <virtualhost> and see/post what it looks like.

I created everything through Virtualmin.

And the reason they weren’t resolving was because the Zone Records aren’t being formed right. There must be some value I haven’t entered as a default that’s causing this. In each record, the first and second occurence of the domain name was the “@” symbol. i.e.
@ SOA IN ns1.mydomain.us. and then
@ IN A 12.34.56.78 and a couple other places, I think.

The mydomain.us record is the ONLY one that contains the additional two lines:

ns1.mydomain.us. IN A 12.34.56.78
ns2.mydomain.us. IN A 12.34.56.78

Otherwise they are identical except for the domain name.

I remember another post where it said that “@” symbol was wrong. I’ll go look up the post.

In the meantime, I again hand-edited each Zone Record to correct its syntax. Once I got it correct, all three Domains reolved perfectly and instantly. Also, www.intodns.com agreed that the records were correct. The only warning I got was about having only one IP Number to work with, but those were "Yellow warnings", not "Red warnings".

httpd.conf VirtualHosts section is as follows:

[code:1]
<VirtualHost 12.34.56.78:80>
SuexecUserGroup "#501" "#502"
ServerName mydomain.us
ServerAlias www.mydomain.us
ServerAlias lists.mydomain.us
DocumentRoot /home/(account name)/public_html
ErrorLog /home/(account name)/logs/error_log
CustomLog /home/(account name)/logs/access_log combined
ScriptAlias /cgi-bin/ /home/(account name)/cgi-bin/
ScriptAlias /awstats /home/(account name)/cgi-bin
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/(account name)/public_html>
Options Indexes IncludesNOEXEC FollowSymLinks
allow from all
AllowOverride All
</Directory>
<Directory /home/(account name)/cgi-bin>
allow from all
</Directory>
Alias /dav /home/(account name)/public_html
Alias /pipermail /var/lib/mailman/archives/public
<Location /dav>
DAV On
AuthType Basic
AuthName mydomain.us
AuthUserFile /home/(account name)/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
</Location>
<Files awstats.pl>
AuthName "mydomain.us statistics"
AuthType Basic
AuthUserFile /home/(account name)/.awstats-htpasswd
require valid-user
</Files>
RedirectMatch /cgi-bin/mailman/([^/])(.) https://mydomain.us:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
RedirectMatch /mailman/([^/])(.) https://mydomain.us:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
</VirtualHost>
[/code:1]

That’s typical of all three domains. Where you see 12.34.56.78, my actual dedicated Public IP appears. Where you see (account name), that’s replaced by the actual user name I assigned to the Domain. (The usernames were created by Virtmin, too.) Where you see mydomain.us, that’s different in each VirtualHost entry and correct in all three sections as mydomain.us mydomain.org and mydomain.net

Yes, suexec points to home:

[root@server /]# suexec -V
-D AP_DOC_ROOT="/home"
-D AP_GID_MIN=100
-D AP_HTTPD_USER="apache"
-D AP_LOG_EXEC="/var/log/httpd/suexec.log"
-D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
-D AP_UID_MIN=500
-D AP_USERDIR_SUFFIX="public_html"
[root@server /]#

I’m getting more and more baffled, lol.
Thanks for your help.

also it doesn’t look like you activated mod_fcgid in the server template on creation as that will add following to the directives:

<Directory /home/domain/public_html>
Options Indexes IncludesNOEXEC FollowSymLinks ExecCGI
allow from all
AllowOverride All
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/domain/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/domain/fcgi-bin/php5.fcgi .php5
</Directory>
<Directory /home/domain/cgi-bin>
allow from all
</Directory>
RemoveHandler .php
RemoveHandler .php5

Virtualmin can’t tell what the correct IP for your system is. Is this a virtualized system of some sort? (vservers, or its descendants OpenVZ or Virtuozzo, in particular have this problem because they have oddly named and oddly laid out network interfaces)

Just set it correctly in the Module Configuration in the fields labeled "Network interface for virtual addresses" (which should be the "base" interface…like eth0 or eth1, not eth0:1) and "Default virtual server IP address" which is only needed if the IP you want to use as the default is not the IP found on the interface in the prior option.

If you’re on a private network, you also have to fill in the next DNS IP field with your public IP.

Well, given what Ronald said, on a hunch I edited httpf.conf directly with vi and replaced 12.34.56.78:80 in all three <VirtualHost> entries with 192.168.1.200:80

And now everything works. Hallelujah! All three domains are now resolving their proper directories of /home/(name)/public_html.

But this brings up the question of why Virtualmin didn’t set things correctly to start with. Which leads me to believe I had a wrong address in there somewhere.

I think I’m going to delete all three domains, and try Virtualmin again.

Thank you both for your help. I appreciate it.

I may be back. :wink:

virtualmin - system settings - server templates - default settings - Apache website
on that pade 2/3 down, find "Default PHP execution mode"

Also in the dropdown go to BIND dns domain to add the line in the upper box.

If you are going to host domains for others, you might consider cloning the default template and experiment with that one instead of the default one…

Well, I’d just as soon do this right, for my own education if nothing else.

I believe I have PHP set globally ON, since in

/etc/httpd/conf.d/php.conf

the AddHandler and AddType lines are NOT commented out.

How do I remove the gpl version and replace it with a "correct" one?

Thanks in advance, once again.

running in mod_php is a right way. the domains will run as apache were as with mod_fcgid the domains will run as their respective owner.
Both have pro’s and cons.

If you really want to run in mod_fcgid the good way to do it is to upgrade to VM Pro imo.

PHP is on in both modes… it means how scripts are executed.
as apache (1 php.ini) or as domain owner (each has php.ini)

if you intend to run only a few domains why not use it as it is?

Well, this whole project is only an exercise for my education.

The domains belong to me, and are unused. The DSL service I’m already paying for, and the comnputer was built from “leftovers” I have here.

I hope to translate what I learn into a paying enterprise, but for now it’s being done without spending any money and that’s a requirement since my finances are next to nothing.

That’s why I’d like to learn how to set things up in various ways, and mod_fcgid seems to be one of those options.

On a positive note, Virtualmin handled everthing ELSE perfectly. The SSH, FTP and now Email are working perfectly.

I just wish I knew what it was I originally set wrong, because at first the Virtual Servers WERE using the Private IP of 192.168.1.200 but they weren’t even resolving, so I changed the adresses to my Public IP. Now they’re using that LAN number again and they ARE working. Owell. A learning experience, like I said.

I appreciate the help that you and Joe have given me.

Thank you both, very much.

OK, I do have a problem after all. The editing I did to httpd.conf to fix the problem originally, apparently wasn’t the only thing wrong. I deleted one domain, and recreated it, then made the changes to the DSN Zone that I had to do before(Virtmin still puts that @ symbol in there, and that just won’t wotk). But then checked httpd.conf, and this time the IP address WAS the same as the existing two that DO work.

I had just ONE thought as to why it isn’t working: When you delete a Comain, then recreate it immediately, will it still have a propagation delay of x hours, perhaps due to the new serial number of the virtual server? If so, perhaps this will start working tomorrow? www.intodns.com says all the settings are correct.

I am SO confused at this point, lol…

Well, I may have been on to something. The new Domain now resolves.

So, I’m left with just the first problem:

SOMEWHERE there’s a setting I need to change, to get rid of that @ symbol in the newly-created DNS Zone Record.

Any suggestions where to look?

Thanks again.

Basically what went wrong is the apache suexec was pointing to /var/www instead of home. By installing on a minimum OS with the install.sh, this issue was tackled.

secondly because you are behind a router you need to tell VM about it in that module config.

Now that you have a working system, it is time to finetune it. For the @ in bind, check all your settings in the modules and server template. Clone the template and use that cloned template to create different domains with different settings.

simply create subservers on top level, i.e test.domain.us (so not as subdomain but as sub server on top level)

Also it would be wise to catch up on the documentation site http://www.virtualmin.com/documentation/ to get some ideas of what is possible.

Thanks again, Ronald. I’ll clone a template and experiment with it.

At this point, it appears the only remaining problem is the @ symbol. I can always override that with a template that uses a complete replacement of the default DNS Zone build, but I’d like to nail it down to where it doesn’t NEED the replacement for that part.

I’ll forge ahead!

not sure what you mean with the @ symbol as it is fine in the zone.
This is one of mine
server.nl is the box
domain.be the clients domain

$ttl 10H @ IN SOA ns1.server.nl. postmaster.server.nl. ( 2008063001 4H 1H 1W 10H ) @ IN NS ns1.server.nl. @ IN NS ns3.server.nl. domain.be. IN A 12.34.56.78 www.domain.be. IN A 12.34.56.78 ftp.domain.be. IN A 12.34.56.78 m.domain.be. IN A 12.34.56.78 localhost.domain.be. IN A 127.0.0.1 mail.domain.be. IN A 12.34.56.78 domain.be. IN MX 5 mail.domain.be. domain.be. IN TXT "v=spf1 a mx a:domain.be ip4:12.34.56.78 ?all" domain.be. IN NS ns2.server.nl. domain.be. IN MX 10 ns3.server.nl.

the <VirtualHost 12.34.56.78:80> should be <VirtualHost 192.168.1.200:80>

apache listens to internal IP and the WAN should be in the dns records.
this can be done under system settings-module config.

in the server template under BIND dns domain you can add
${DOM}. 38400 IN NS ns2.domain.us.
in the big box. Note the . at the end

the zonefile looks like this

$ttl 38400
@ IN SOA ns.domain.us. postmaster.domain.us. (
2008071801
10800
3600
604800
38400 )
@ IN NS ns.domain.us.
domain.us. IN A 12.34.56.78
www.domain.us. IN A 12.34.56.78
ftp.domain.us. IN A 12.34.56.78
m.domain.us. IN A 12.34.56.78
localhost.domain.us. IN A 127.0.0.1
mail.domain.us. IN A 12.34.56.78
domain.us. IN MX 5 mail.domain.us.
domain.us. IN TXT "v=spf1 a mx a:domain.us ip4:12.34.56.78 ?all"

Darnit, edit won’t work.

Ronald, how do I "enable mod_fcgid"??

And where exactly is the template you mention when you said:

"in the server template under BIND dns domain you can add
${DOM}. 38400 IN NS ns2.domain.us.
in the big box. Note the . at the end"

I can find no server template in BIND. What is the “click-path”?
I’m still learning. :wink:

Thanks again.

Again, thanks. This has been very helpful.

I added the line "${DOM}. 38400 IN NS ns2.domain.us." to the "BIND DNS Domain" (changing the word "domain" to my real domain name).

But on the "virtualmin - system settings - server templates - default settings - Apache website" there is no such checkbox labeled "Default PHP execution mode".

Did you mean that I should simply add the following lines:

AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/domain/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/domain/fcgi-bin/php5.fcgi .php5

to the window titled "Directives and Settings for New Website"??

Because if there’s supposed to be a checkbox labeled “Default PHP execution mode” it simply isn’t there.

i see, you must be running the gpl version. this has no php execution mode buttons.

Adding those lines won’t cut it as far as i know. it also needs the remove handlers and it needs to create the folders and files under the $DOM directory which the gpl version won’t do.

it won’t matter that much as you want probably only those 3 domains on your system and you can set all directives through httpd.conf in the <virtualhost> part and you can use .htaccess as well.

You can add it in the server template-apache website, stuff like:
php_admin_value memory_limit 32M
php_admin_value enable_dl Off
php_admin_value magic_quotes_gpc On
php_admin_value open_basedir ${HOME}:${HOME}/tmp:/usr/lib/php:/usr/share/pear
of course please do settings and paths to match your system…or use the appropiate webmin module…webmin-servers-apache webserver-click on virtual server for the domain you want to edit-click on PHP icon-add the values you want

mod_fcgi comes in handy if you plan to host many domains and want to give each domain its own php.ini file.

i see, you must be running the gpl version. this has no php execution mode buttons.

Adding those lines won’t cut it as far as i know. it also needs the remove handlers and it needs to create the folders and files under the $DOM directory which the gpl version won’t do.

it won’t matter that much as you want probably only those 3 domains on your system and you can set all directives through httpd.conf in the <virtualhost> part and you can use .htaccess as well.

You can add it in the server template-apache website, stuff like:
php_admin_value memory_limit 32M
php_admin_value enable_dl Off
php_admin_value magic_quotes_gpc On
php_admin_value open_basedir ${HOME}:${HOME}/tmp:/usr/lib/php:/usr/share/pear
of course please do settings and paths to match your system…or use the appropiate webmin module…webmin-servers-apache webserver-click on virtual server for the domain you want to edit-click on PHP icon-add the values you want

mod_fcgi comes in handy if you plan to host many domains and want to give each domain its own php.ini file.

Not sure why, but in my setup the @ symbol just doesnt work. The Domain won’t resolve unless I replace all @ symbols with the correct Domain name.

But I created a new server template per your suggestion (thanks again) and in the DNS BIND Section put the following:

[code:1]
$ttl 38400
${DOM}. IN SOA ns1.mydomain.us. admin.${DOM}. (
1219107587
10800
3600
604800
38400 )
${DOM}. IN NS ns1.mydomain.us.
${DOM}. IN NS ns2.mydomain.us.
${DOM}. IN A 12.34.56.78
localhost IN A 127.0.0.1
${DOM}. IN MX 5 ${DOM}.
www IN CNAME ${DOM}.
mail IN CNAME ${DOM}.
ftp IN CNAME ${DOM}.
[/code:1]
and this works perfectly. I deleted and recreated all 5 Domains (I added 2 more) about an hour ago, and they all work like a champ. The Mail works, too. Imagine that. :wink:

Now I want to tackle getting phpMyAdmin installed. I saw it mentioned elsewhere on this site, so I’m assuming this is something I can accomplish.

Thanks again for all your help. And Joe, too!