Solved

Hosting multiple websites on a webserver...

Posted on 2013-02-05
8
338 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Application Discovery Service in AWS

In the era of the cloud, customers migrating away from their existing on-premise infrastructure. This requires lots of planning, strategies, and effort to identify their existing resources and determine how best to migrate.  Datacenter migrations happen in four phases -

 

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

 Database Backup and Recovery Best Practices

Join Percona’s, Architect, Manjot Singh as he presents Database Backup and Recovery Best Practices (with a Focus on MySQL) on Thursday, July 27, 2017 at 11:00 am PDT / 2:00 pm EDT (UTC-7). In the case of a failure, do you know how long it will take to restore your database?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to dynamically set the form action using jQuery.

624 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