2

I have a running server machine at my work that hosts firstwebsite.com currently. I want to secondwebsite.com on the same machine. secondwebsite.com is hosted on godaddy. Is is possible to host the two websites on the same machine? I have added a htaccess file in etc/apache2/sites-enabled/ which is as follows:

<VirtualHost *:80>
    ServerAdmin admin@secondwebsite.com
    ServerName secondwebsite.com
    ServerAlias secondwebsite.com
    DocumentRoot /var/www/test/public_html
</VirtualHost>

I guess I have to change dns or cname in GoDaddy? Can you guys help me figure out this problem. Any help would be appreciate.Thank you so much.

codeblock
  • 47
  • 7

3 Answers3

1

Yes this is possible. The documentation for Apache is full of better examples than I could provide..

The one you would like to start with is here:

http://httpd.apache.org/docs/2.2/vhosts/examples.html

If you have problems, make sure the examples and help you find are for the same version of Apache that you are using (the one I mentioned is for 2.2)

Klathzazt
  • 2,415
  • 19
  • 27
1

Yes you can host multiple websites on same machine. There are two possible ways :-

  1. Only one apache instance and using Virtual host directive methodology to host two domains. Use of Virtual Host can be seen in Apache Documentation.
    But in this case both domain will start and stop at same time when apache is started/stopped.

  2. Use two apache instances on two different paths on same machine with diffrent DocumentRoot for both domains.
    This will ensure both domains will not be dependent on each other and can be started/stopped independently.

uniwald
  • 46
  • 4
1

It is also possible to host multiple domains on same hosting account on godaddy, depending on your hosting packet. See addon-domains.

As for apache, of course it is possible, other answers already pointed to necessary information.

Tuncay Göncüoğlu
  • 1,699
  • 17
  • 21