Solved

Hosting multiple websites on a webserver...

Posted on 2013-02-05
8
333 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

786 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