Serving 2 diffrent websiteswith two diffrent ips
Posted by: mattfox (---.west.biz.rr.com)
Date: July 02, 2008 04:15AM

So i have multiple external ip addresses and i want to host two completely diffrent websites with one server. Example.

www.food.com IP 77.45.44.44 external
www.beer.com IP 77.45.44.45 external

So i don't need to host multiple sites on one IP i have the IPs two do it seperate.
So i have set my NIC for two internal ips 192.168.1.1 and 192.168.1.2 I want to assign each website to each internal ip then map them to my external ips through my firewall.

Now, do i have to do the virtualhost thing or can i just do directories pointin to my internal ip's, since i'm not trying to host 2 websites on the same ip. For example will something like this work?


document root c:/wamp/www/www1

Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 192.168.0.1

And then just do the same thing for my other site...alll in http.conf or do i have to do the vhost thing?

Options: ReplyQuote
Re: Serving 2 diffrent websiteswith two diffrent ips
Posted by: yfastud (Moderator)
Date: July 02, 2008 04:32AM

There is more than 1 type of VH: Name base and IP base. You should check Apache website for how-to setup IP base VH ;-)

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: Serving 2 diffrent websiteswith two diffrent ips
Posted by: mattfox (---.west.biz.rr.com)
Date: July 02, 2008 09:02AM

Ya i have checked all those places i have looked all over the internet for the info...i just don't understand what i have to put in http.conf. I understand what to put in the vhost file i think but where do i put the file permisions,

like the
directory c:/wamp/www/site1
allow, deny
deny from all
allow from 192.168.0.1

Where do i put that stuff? In the http.conf or the vhost file? Can you give me an example of what should go in the vhost file and the http.conf

Options: ReplyQuote
Re: Serving 2 diffrent websiteswith two diffrent ips
Posted by: yfastud (Moderator)
Date: July 02, 2008 03:11PM

If you follow my guide step by step, you should have the answer for that question

[guides.jlbn.net]

If you like short answer, here it is: enable vh in httpd file and setup vh in vhosts file

If you like more detail, here is apache website document

[httpd.apache.org]

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: Serving 2 diffrent websiteswith two diffrent ips
Posted by: mattfox (---.west.biz.rr.com)
Date: July 02, 2008 10:26PM

Ya i followed the guide, but what do i put in http.conf? If i don't put directory permissions anywhere how will it be kept safe? Can i put something like this in vhost file?

<VirtualHost 192.168.0.34:80>
ServerName test
ServerAlias sub
DocumentRoot C:/wamp/www/www1/
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
Options -Indexes FollowSymLinks
<Directory c:/wamp/www/www1>
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
allow from 192.168.0.34
</Directory>
<IfModule dir_module>
DirectoryIndex index.php index.php3 index.html index.htm
</IfModule>
ErrorLog C:/wamp/log/error.log
CustomLog C:/wamp/log/access.log common
</VirtualHost>


<VirtualHost 192.168.0.35:80>
ServerName test1
ServerAlias sub2
DocumentRoot C:/wamp/www/www2/
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
Options -Indexes FollowSymLinks
<Directory c:/wamp/www/www2>
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
allow from 192.168.0.35
</Directory>
<IfModule dir_module>
DirectoryIndex index.php index.php3 index.html index.htm
</IfModule>
ErrorLog C:/wamp/log2/error.log
CustomLog C:/wamp/log2/access.log common
</VirtualHost>


Then what do i put in http.conf...

Options: ReplyQuote
Re: Serving 2 diffrent websiteswith two diffrent ips
Posted by: toivo (---.nsw.bigpond.net.au)
Date: July 02, 2008 11:35PM

Hi,

Looks ready for testing. If you want to check the syntax first, go to the command prompt and run httpd with the test switch:

c:
cd \wamp\bin\a*\a*\bin
httpd -t

If you change the settings, do not forget to restart Apache.

Regards,

toivo
Sydney, Australia

Options: ReplyQuote
Re: Serving 2 diffrent websiteswith two diffrent ips
Posted by: mattfox (---.west.biz.rr.com)
Date: July 03, 2008 01:50AM

ok so i think i got it figured out...

Whats the diffrence between putting the vhost stuff in the vhostconf file or just putting it in the http.conf?

Options: ReplyQuote
Re: Serving 2 diffrent websiteswith two diffrent ips
Posted by: mattfox (---.west.biz.rr.com)
Date: July 03, 2008 01:55AM

OK so i redid my vhost configuration...i put this all in the http.conf file...how does it look, is this right and secure?

#=========DirectorySecurity==========
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>

#Site1
<Directory "c:/wamp/www/www1/">
Options -Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</Directory>

#Site2
<Directory "c:/wamp/www/www2/">
Options -Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</Directory>

#==========VirtualHost============

NameVirtualHost *:80

<VirtualHost 192.168.0.34:80>

ServerAlias domain.com domain
DocumentRoot C:/wamp/www/www1
ErrorLog C:/wamp/logs/error.log
CustomLog C:/wamp/logs/access.log common
</VirtualHost>


<VirtualHost 192.168.0.35:80>

ServerAlias sub1
DocumentRoot C:/wamp/www/www2
ErrorLog C:/wamp/log2/error.log
CustomLog C:/wamp/log2/access.log common
</VirtualHost>

<IfModule dir_module>
DirectoryIndex index.php index.php3 index.html index.htm
</IfModule>

<FilesMatch "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>

Options: ReplyQuote


Sorry, only registered users may post in this forum.