phpfanphp Posted September 14, 2007 Share Posted September 14, 2007 I got apache up and running, and I'm able to access a site with a dynamic IP remotely. So, apache is set up correctly and hosting just one (1) site. If I want to host 2 sites, let's say www.domain1.com and www.domain2.com with my one apache computer, how do I do that? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/69274-solved-how-does-apache-know-what-site-to-host/ Share on other sites More sharing options...
redarrow Posted September 14, 2007 Share Posted September 14, 2007 sorry made a big error there the last post was to goto another webserver Port 80 ServerName server.domain.tld NameVirtualHost 111.22.33.44 <VirtualHost 111.22.33.44> DocumentRoot /www/domain ServerName www.domain.tld ... </VirtualHost> <VirtualHost 111.22.33.44> DocumentRoot /www/subdomain ServerName www.sub.domain.tld ... </VirtualHost> link http://httpd.apache.org/docs/1.3/vhosts/examples.html Quote Link to comment https://forums.phpfreaks.com/topic/69274-solved-how-does-apache-know-what-site-to-host/#findComment-348104 Share on other sites More sharing options...
ToonMariner Posted September 14, 2007 Share Posted September 14, 2007 apache has a nifty little app called 'MindReader' that helps it serve the correct files from the correct site... don't listen to redarrow - he goes on about some kind of newfangled technology that can actually recognize things... a pipedream if you ask me. Quote Link to comment https://forums.phpfreaks.com/topic/69274-solved-how-does-apache-know-what-site-to-host/#findComment-348108 Share on other sites More sharing options...
redarrow Posted September 14, 2007 Share Posted September 14, 2007 you use VirtualHost ok not joking and it easy i use it all day.......... ToonMariner pipe dream your mad lol......... Quote Link to comment https://forums.phpfreaks.com/topic/69274-solved-how-does-apache-know-what-site-to-host/#findComment-348109 Share on other sites More sharing options...
phpfanphp Posted September 14, 2007 Author Share Posted September 14, 2007 lol, 4000+ posts and you are talking about learning more! Man, you must know your PHP!!! What do you mean by the 111.22.33.44? Is that the ip address of my cable line? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/69274-solved-how-does-apache-know-what-site-to-host/#findComment-348110 Share on other sites More sharing options...
redarrow Posted September 14, 2007 Share Posted September 14, 2007 see this please read you got google. Server configuration # Ensure that Apache listens on port 80 Listen 80 # Listen for virtual host requests on all IP addresses NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /www/example1 ServerName www.example1.com # Other directives here </VirtualHost> <VirtualHost *:80> DocumentRoot /www/example2 ServerName www.example2.org # Other directives here </VirtualHost> Quote Link to comment https://forums.phpfreaks.com/topic/69274-solved-how-does-apache-know-what-site-to-host/#findComment-348111 Share on other sites More sharing options...
redarrow Posted September 14, 2007 Share Posted September 14, 2007 do i need to goto the server and copy mine? made it even easer now # Listen for virtual host requests on all IP addresses NameVirtualHost *:80 <VirtualHost *:80> // this is where the web files are sitting. DocumentRoot /www/example1 //this is your www. name ServerName htpp://example1.com # Other directives here </VirtualHost> <VirtualHost *:80> // this is where the web files are sitting. DocumentRoot /www/example2 //this is your www. Name ServerName http://example2.org # Other directives here </VirtualHost> Quote Link to comment https://forums.phpfreaks.com/topic/69274-solved-how-does-apache-know-what-site-to-host/#findComment-348113 Share on other sites More sharing options...
redarrow Posted September 14, 2007 Share Posted September 14, 2007 here u go fully tested configuration for free domain setup. you dont add silly programs to goto files use the correct way or no way. all the best redarrow in apache config page unmark these LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_connect_module modules/mod_proxy_connect.so LoadModule proxy_http_module modules/mod_proxy_http.so add this to your page at the bottom NameVirtualHost *:80 # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. # <VirtualHost *:80> ServerName my_free_domain.com DocumentRoot "C:\Program Files\Apache Group\Apache2\web_site_1" </VirtualHost> <VirtualHost *:80> ServerName my_free_domain.com DocumentRoot "C:\Program Files\Apache Group\Apache2\htdocs\web_site_2" </VirtualHost> <VirtualHost *:80> ServerName my_free_domain.com DocumentRoot "C:\Program Files\Apache Group\Apache2\htdocs\web_site_3" </VirtualHost> <VirtualHost *:80> ServerName my_free_domain.com ProxyPass / http://192.168.0.4:32000/mail/ <<example to another server with port settings </VirtualHost> apache is easy and good fun to learn please read the manual or a book, you need to learn as much as possable, take your time good luck............... Quote Link to comment https://forums.phpfreaks.com/topic/69274-solved-how-does-apache-know-what-site-to-host/#findComment-348131 Share on other sites More sharing options...
phpfanphp Posted September 14, 2007 Author Share Posted September 14, 2007 redarrow, you're the MAN! Thanks!!!!!! Quote Link to comment https://forums.phpfreaks.com/topic/69274-solved-how-does-apache-know-what-site-to-host/#findComment-348726 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.