LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   2+ sites, 1 ip...is this possible? (http://www.linuxquestions.org/questions/linux-newbie-8/2-sites-1-ip-is-this-possible-527426/)

eagletalontim 02-10-2007 06:17 PM

2+ sites, 1 ip...is this possible?
 
I have just installed Linux Suse 10.0 on my computer at my house and fowarded 2 domain names to my ip address. I have tried all i can, but i cannot figure out how to make it to where www.site1.com goes to a certain folder and www.site2.com goes to another folder. basically, i want to run more than one site from my server without them showing the same thing when accessed.

any help would be greatly appreciated!

Brian1 02-10-2007 06:42 PM

This what you are after if using Apache.
http://httpd.apache.org/docs/1.3/vhosts/

Brian

eagletalontim 02-10-2007 09:07 PM

ok, i tried everything on there, but it is still not working. both domains are still going to to the default folder. Do i have to have the domains pointing to a Nameserver in order for apache to detect the site? both domains are just fowarded to my ip address. there are no nameservers set.

billymayday 02-10-2007 09:25 PM

I think you will need to set up nameservers. Have you looked at www.zoneedit.com?

eagletalontim 02-11-2007 12:51 AM

i was trying to find a way around having to use nameservers. is there any way to have several sites on one ip address with no nameservers set?

billymayday 02-11-2007 01:10 AM

I don't know enough about the technicalities of apache/browsers, but I would have thought that as soon as you forward you lose the name information.

Why do you want to avoid nameservers? It's easy and zoneedit won't charge for < 5 domains

Samoth 02-11-2007 07:47 AM

What would happen if you set up a NAT firewall, have two NICs on the server(each with a different IP) and then set up port forwarding on the NAT firewall. So, one server runs on port :80 and the other one runs on :8080. When you go to :80 on the NAT side, it routes you to the :80 apache server, and when you go to :8080 on the NAT side, it forwards it to the :8080 apache server.
Code:

  |                                |(:8080)
  |(Internet)                      |
---------------------(NAT)----------|          (Both same comp but different NICs.
  |                                |(:80)
  |


eagletalontim 02-11-2007 01:33 PM

ok, i found out that on Godaddy, you can set the total dns control host to the ip address of the server. i have already done that on 2 domains. now insead of both domains going directly to the ip address in the address bar, it now shows just the domain. Now, what do i have to do to make the server recognize what domain is what and point them to different folders? I already tried to add virtual hosts with the httpd.conf, but nothing is working. here is my config:

PHP Code:

NameVirtualHost *

<
VirtualHost *>
ServerAlias site1.com *.site1.com
ServerName www
.site1.com
DocumentRoot 
/home/site1/public_html
</VirtualHost>

<
VirtualHost *>
ServerAlias site2.com *.site2.com
ServerName www
.site2.com
DocumentRoot 
/home/site2/public_html
</VirtualHost

Thanks!

billymayday 02-11-2007 01:38 PM

btw, you may have issues trying to access /home directories from apache

eagletalontim 02-11-2007 01:45 PM

yes. they always say access denied. is there a way around that?

Samoth 02-11-2007 04:11 PM

The most likely reason you are getting "access denied" is because the files have to be ownable by "apache.apache". I wouldn't know how to fix it, just pointing out the reasons ;-)

prasanta 02-11-2007 10:52 PM

Quote:

they always say access denied. is there a way around that?
Have a look at this,

http://www.mjmwired.net/resources/mj...ual-sites.html
http://httpd.apache.org/docs/2.0/howto/public_html.html

--
Prasanta

arroquant 02-15-2007 11:48 AM

Quote:

Originally Posted by eagletalontim
I have just installed Linux Suse 10.0 on my computer at my house and fowarded 2 domain names to my ip address. I have tried all i can, but i cannot figure out how to make it to where www.site1.com goes to a certain folder and www.site2.com goes to another folder. basically, i want to run more than one site from my server without them showing the same thing when accessed.

any help would be greatly appreciated!

its actually quite easy if you read and follow the instruction given in the apache manual in vhost section.

i've set up apache on 2 machines with mass vhost setting. so i can manage all the vhosts easily.

this is some part from the httpd.conf which set up the dynamic "virtual-host"ing
Code:

# get the server name from the reverse DNS of the IP address
UseCanonicalName DNS

# include the IP address in the logs so they may be split
LogFormat "%A %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon

# include the IP address in the filenames
VirtualDocumentRootIP /www/hosts/%0/docs
VirtualScriptAliasIP  /www/hosts/%0/cgi-bin

with this, if i want to host a new domain (www.asik.com for example), all i have to do is only creating directory "/www/hosts/www.asik.com/", and put the web files on directory "/www/hosts/www.asik.com/docs/". and then restart/reload the apache daemon.

and the thing after that, of course you have to deal with nameserver you're connected with. so that all request for your page/domain should be redirected to your webserver.

:D

Keyword: "Apache Manual", "mass vhost"

v00d00101 02-15-2007 12:08 PM

Why not set apache user home to say /home/apache, make a directory called htdocs1 and htdocs2, then set it up from your apache conf file. If permissions are borked, try running something like this from console as root/su.

Code:

chown -R apache.apache /home/apache
Also running two servers on two different ports is a really long winded way of solving a simple problem. Using vhost's you can do both sites from one conf file and one server. The only time you would need a second server is if you wanted apache-ssl and didnt want to use mod_ssl.


All times are GMT -5. The time now is 11:05 PM.