All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Cofigure VirtualHost in VPS !
hi frnds,
i'm trying to host 2 sites in my VPS using VirtualHost. but i can't configure it correctly. can any one explain how to do this. i add A records with www point to my VPS IP in both domains. and then i create 2 folders in www folder like this.
/var/www/site1/public_html
/var/www/site2/public.html
after that i place different index.html files in both locations. and i set permission using this command.
chown -R root:root /var/www/site1/public_html
chown -R root:root /var/www/site2/public_html
and after of that i edit the httpd.conf file and add this lines to the VirtualHost section.
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/site1/public_html ServerName www.site1.com </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/site2/public_html ServerName www.site2.com </VirtualHost>
but the problem is both domains are get the apache 2 test page. please anyone can help me to resolve this problem. thanks ...
Comments
Did you restart your Apache after the changes are made? If that still does not work, try issue a reboot.
Wouldn't a config reload be enough?
chown -R www-data:www-data /var/www/site1/public_html ?????
Make sure to get rid of any default config too
edit for clarity: Apache should have a default vhost file created depending on your distribution that can cause other VirtualHosts that you create yourself to not load properly; check and make sure that isn't the case.
mmm ... i installed httpd server and php engine only ...
is there any tutorial for this ... ??
Here's the Linode Library information on basic installation and vhosts I use as a reference https://library.linode.com/web-servers/apache/installation/debian-6-squeeze
If this server is bare currently, I would suggest trying out ZPanel. Super user friendly install, and everything (for me) worked right out of the box on CentOS 6.4. And it is free. I believe you need to install this on a fresh server, though, so you would likely have to reinstall.
www.zpanel.com
also you shouldn't give root ownership of those files, and/or check and see if the directories are set to rwxr-xr-x (755)
What tutorial do you use before?
Try install webmin, it will detect what you already installed so we can know what to do.
Edit apache2.conf?
Also, it's better to create individual conf files for each site in /etc/apache2/sites-available and use a2ensite
i use this tutorial ... ?
https://www.digitalocean.com/community/articles/how-to-set-up-apache-virtual-hosts-on-centos-6
pretty sure all a2ensite does is symbolically link them to sites-enabled
The point is that apache on some distros is ignoring httpd.conf and using apache2.conf (and individual configs in sites-enabled). Sure, you can just ln -s blah blah but it's easier to a2ensite?
i'm working on cent os 6.3 minimal ... is there any issue ...
yum install apache2 say's
It's HTTPD on CentOS...
yes i'm currently working with httpd ...
You're trying to do "yum install apache2" on CentOS, that won't work as you've seen
Then i said that it's yum install httpd, and you're just saying that you're "currently working with httpd"
Did i mis something?
nope ... i'm just try to install apache2 in this ... but it doesn't work & my previous httpd is working now ...
198.23.249.33
this is the IP of my server ... now i rebuild it with cent os 6.3 minimal & i installed httpd in it ... then i need to host two domains in this server ... can anyone please help me to do it ... i execute this commands set only ...
yum install nano
yum install php
service httpd start
what i do next ...
http://github.com/KnightSwarm/Minstall may help ?
From fresh vps,
I suggest you install webmin, after that login, and you don't have anything installed yet, so use webmin to install it.
For better process use virtualmin, it just few click shorter compared to webmin.
https://www.digitalocean.com/community/articles/how-to-set-up-apache-virtual-hosts-on-centos-6 tutorial is not complete.
@shyaminayesh - Great site for Linux server config/setup, multiple distros.
http://www.server-world.info/en
ServerName site1.com
ServerAlias www.site1.com
Try this for both? With your current setup it will only server the site to www.site1.com and www.site2.com but not if you go to site1/2.com
Also don't have Root as the owner of the web files.
i install webmin ... and i create 2 sites using it ... now the problem is both sites give me the same index.html file
http://www.sithruu.info/
http://www.freethemebucket.info/
@shyaminayesh your virtual host containers are not correct. If you want me to do this for you send me a PM.
If not first don't put your containers in httpd.conf. Also you are trying to make use of name based virtual hosts and your ServerNames are not right. Set your www. with ServerAlias.
Would be a lot easier just to do it for you so you can see all of this in action. You are doing too much wrong.
Try this:
<VirtualHost your_IP:80> ServerAdmin [email protected] ServerName site1.com ServerAlias site1.com DocumentRoot /var/www/site1.com/public_html ErrorLog logs/site1_com-error_log CustomLog logs/site1_com-access_log common </VirtualHost>
@vladinc That's the right one.
I agree, something in the setup is causing your virtualhosts to not work. i have webmin on a few systems and i also have just a CLI on the rest. PM @natestamm or me if you want us to look at it in the mean time.