Solved

Hosting multiple websites on a webserver...

Posted on 2013-02-05
8
328 Views
Last Modified: 2013-02-20
I have Linux server with LAMP installed. Since I have a dynamic connection I am using DynDNS to track my IP. So, my domain comp-stuff.com is configured to point to my DynDNS address (using URL Frame-CNAME-masking)...

rubantin.gotdns.com:8080/compstuff is the address I point too with it...

My site resides in the "compstuff" folder on my server's web root...

I am going to host 7 other sites on this server. I plan on simply creating 7 other folders and pointing the domain to:

rubantin.gotdns.com:8080/(folder)

Is this the best practice for what I am doing? Or is there a better way?

I was reading something about masking vs mapping... is there something to that?

Russ
0
Comment
Question by:ambantin
  • 4
  • 4
8 Comments
 
LVL 9

Expert Comment

by:oheil
ID: 38858796
I would configure apache with VirtualHosts:
http://httpd.apache.org/docs/2.2/vhosts/

Your DnyDNS entry points to your local Server on port 8080 for all domains. Apache serves the web site which is requested automatically.
Example apache conf:
...
<VirtualHost *:8080>
        ServerName www.domain1.de
        DocumentRoot /var/www/domain1/
        ...
</VirtualHost>
<VirtualHost *:8080>
        ServerName www.domain2.de
        DocumentRoot /var/www/domain2/
        ...
</VirtualHost>
...

Note:
If you going to use some CMS (content management system) you need some multi-domain capable system like Typo3.

Thats what comes into mind when I read your question. But I am unsure. Maybe I miss the point.

Oli
0
 

Author Comment

by:ambantin
ID: 38861508
Will this make a difference?

I have to use 8080 because I have a phone VOIP router that uses 80 to display its web content.... So it goes modem>VOIP (Port 8080 forwarded)>router (Port 8080 forwarded to port 80 on the webserver)....

So would it be <VirtualHost *:8080> or <VirtualHost *:80>  ?
0
 
LVL 9

Expert Comment

by:oheil
ID: 38861569
If your apache listens on 80 it must be <VirtualHost *:80>

Oli
0
 

Author Comment

by:ambantin
ID: 38861801
just to double check... is it in

/etc/apache2/apache2.conf or

/etc/apache2/httpd.conf or

/etc/apache2/sites-enabled/000-default.conf
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 9

Accepted Solution

by:
oheil earned 500 total points
ID: 38863001
In my configuration I have for each domain a configuration file in /etc/apache2/sites-available. Each file contains its own <VirtualHost *:80> configuration. In /etc/apache2/sites-enabled/ there is a symbolic link to the file in sites-available which switches this domain on.
Example:
/etc/apache2/sites-available/www.domain1.com
/etc/apache2/sites-available/www.domain2.com
...
Symbolic links are not straight forward in windows, so I believe, you should do the same (create files per domain) in
/etc/apache2/sites-enabled/www.domain1.com
/etc/apache2/sites-enabled/www.domain2.com
...


But the truth behind my long writing is: It doesnt matter where you put it in as long as apache2 reads the configuration file :-) The above is just convention which differs from OS to OS, even in between like debian and CentOS Linux.

Oli
0
 

Author Comment

by:ambantin
ID: 38863365
sorry... it is sites-available not sites enabled...

so your files look like www.domain.com.conf or what are your actual conf files named?

or can I simple put this in the 000-default file

<VirtualHost *:80>
        ServerName www.domain1.de
        DocumentRoot /var/www/domain1/
</VirtualHost>

<VirtualHost *:80>
        ServerName www.domain2.de
        DocumentRoot /var/www/domain2/
</VirtualHost>
0
 
LVL 9

Expert Comment

by:oheil
ID: 38863382
The convention is, to put a separate file for each domain into sites-enabled (under CentOS e.g.).

For test purpose you can put your VirtualHosts into the 000-default, but you need make sure, that this file is read by the apache server (it maybe not the case).

As I said, you can put it also into /etc/apache2/httpd.conf which might be best for you, because this file is probably the master config file for your server.

Oli
0
 

Author Comment

by:ambantin
ID: 38863634
will try this sunday and post results... thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
HTML table 7 54
PHP and SOAP Woes 7 50
PHP foreach DB query 4 34
SQL to update characters in table column 6 29
Online collaboration is quickly becoming embedded in the workplace, and its benefits are tangible. See what the current landscape looks like and what the future holds for collaboration tools and the future of work.
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now