APACHE2 - Virtual Hosts
Would like to ask how to configure apache2 to host multiple website and how to set it as the main website without displaying the folder:
instead of this
/www/main/index.html = http://www.domain.com/index.html
and add more websites
Thank you in advance,
/www/site2/index.html = http://www.domain.com/site1/index.html
the easiest way (probably the best also) is to setup your names all with the same ip,
ip = 184.108.40.206
at this point all the names should resolve to the same place on your apache. then use name based virtual hosts - Google Search
you can also search for name based virtual hosts in this forum because I know I have posted lots of help on this subject.
This is an excerpt from my /etc/httpd/conf/httpd.conf
just changed domains and port numbers for security.
this is so I can go to my mythweb config without going to http://www.mydomain.com/mythweb instead go to http://myth.mydomain.com:8040
Thanks jledhead and SoX2000 for your reply.
How about for the main site, http://www.mydomain.com?
So it could have 4 sites
Thanks again in advance
The document root for the main site http://www.mydomain.com is /var/www/html/ so anything under that directory is accessible by just adding the directory name to the end of the domain name. /var/www/html/mythweb is accessible by http://www.mydomain.com/mythweb.
If you wish to rename the url without changing the directory name then you can set that in your document root
Gives you access to /var/www/html/mythweb by typing http://www.mydomain.com/MyTV
Ok, but what if the main website is configured and needs to be in a directory other than html?
and needs to be access like this
Thank you so much in advance
I would solve this at the DNS not the webserver.
IP being 220.127.116.11
/var/www/html/site1/ accessible by http://18.104.22.168/site1 or www.mydomain1.com
/var/www/html/site2/ accessilble by http://22.214.171.124/site2 or www.mydomain2.com
or you chould have
This I think should point www.mydomain.com to /var/www/html/mythweb but it may cause problems for any other sites you're running at the same time and wouldn't recommend it.
Thank you so much for all the info, I will try all of these.