PDA

View Full Version : Subdomains on Ubuntu - Linux server gurus needed



[XC] Oj101
11-23-2010, 10:29 PM
Hi guys,

The situation is as follows:

Server: 10.0.0.58, Ubuntu 10.10
Client: 10.0.0.211 OSX 10.6.5
Router: 10.0.0.2

What I need is captial.dev to point to 10.0.0.58, as well as *.capital.dev. Subdomains WON'T be in their own directories, instead we'll just use PHP to call up a certain database depending on the subdomain. E.g. test.capital.dev will point to 10.0.0.58 and load up the test database, helloworld.capital.dev will load up the helloworld database, etc. How do I configure the server to handle the subdomains? I've tried following a few bind9 tutorials but I can't get any of them to work as they should. Any and all help would be appreciated.

I'm going to post this in the networking section as well, if mods feel the need to remove one of the threads please remove THIS ONE.

texnofobix
11-24-2010, 12:31 AM
Oj101;4640109']Hi guys,

The situation is as follows:

Server: 10.0.0.58, Ubuntu 10.10
Client: 10.0.0.211 OSX 10.6.5
Router: 10.0.0.2

What I need is captial.dev to point to 10.0.0.58, as well as *.capital.dev. Subdomains WON'T be in their own directories, instead we'll just use PHP to call up a certain database depending on the subdomain. E.g. test.capital.dev will point to 10.0.0.58 and load up the test database, helloworld.capital.dev will load up the helloworld database, etc. How do I configure the server to handle the subdomains? I've tried following a few bind9 tutorials but I can't get any of them to work as they should. Any and all help would be appreciated.

I'm going to post this in the networking section as well, if mods feel the need to remove one of the threads please remove THIS ONE.

Bare with me. I'm typing this on my phone.
Ok get all your dns records to point to the webserver.

Setup server alias in apache to *.capital.dev

Use the url info from php (I think you can get that.)

[XC] Oj101
11-24-2010, 02:45 AM
Thanks, but I have no idea how any of that is done in Ubuntu :(

TheMike
12-01-2010, 02:10 PM
this should be a good lecture ;) http://httpd.apache.org/docs/2.2/vhosts/examples.html

for your problem:
use your favorite editor and open the "/etc/apache2/sites-available/default"
add the lines in bold



NameVirtualHost *:80

<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>

#this is your "catchall" website:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName myotherdomain.org
ServerAlias *.myotherdomain.org
DocumentRoot /mnt/sdb1/www2/
</VirtualHost>



HTH