Baran Topal

Baran Topal


April 2024
M T W T F S S
« Feb    
1234567
891011121314
15161718192021
22232425262728
2930  

Categories


2 domains, one ip, apache

baranbaran

I was once a rookie and my problem was as this:

I am having a VPS solution meaning i have my own machine having centos and apache, mysql and php are also installed on it.

I was root in the system, i could ssh without any problem.

I bought 2 domains from godaddy but hosting is not provided by godaddy. I set the IP of my VPS solution in godaddy without any issue.

Now everything is working fine in local environment but when i upload those to remote, something became messy.

I am uploading 2 website project folders Foo and Baz under the path /var/www/html
The server is up and running but the problem is that I can only go to the sites when i type
www.foo.com/foo or when i type www.baz.com/baz or its combinations which is ridiculuos.

/var/www/html
|
Foo
|
Baz

I want to go foo when i type www.foo.com  and same for baz.

So, solution is easy:



NameVirtualHost *:80  
ServerName www.foo.com 
ServerAlias foo.com *.fooo.com 
DocumentRoot /var/www/html/foo 
  
ServerName www.bar.com 
ServerAlias bar.com *.bar.com 
DocumentRoot /var/www/html/bar 

You have to add the followings at the end of php.ini or httpd.ini

But where is my httpd.ini?

Simply, execute this command in shell,


php --ini

Voila! You can see your php.ini path in the host. Note that once, you append above configuration, a restart in httpd service is necessary.

The command is:


/etc/init.d/httpd restart

Comments 0
There are currently no comments.