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
Solved

Hosting multiple websites on a webserver...

Posted on 2013-02-05
8
334 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This video teaches users how to migrate an existing Wordpress website to a new domain.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

809 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