Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am a newbie and need some help although I tried going through the other posts. I have successfully installed my drupal site in /var/www/mywebsite folder.

Now I went to the place from where I bought my domain (mywebsite.com) and configured an A record to point to the Elastic IP Address allocated by Amazone to this instance. Everything is fine a nice here. When I browse for mywebsite.com it correctly takes me to the default page in /var/www

But obviously I need to point that website to /var/www/mywebsite. When I enter the link mywebsite.com/mywebsite ... it goes to the right page and everything seems to work fine.

Now what I want to do is point mywebsite.com and www.mywebsite.com to the /var/www/mywebsite folder

And it would be great if I could have another site called yourwebsite.com and I configure it to the same IP but the redirection for yourwebsite.com and www.yourwebsite.com to /var/www/yourwebsite

Please help! I understand that the issue has something to with VirtualHosts and mod_rewrite .. but sorry ... I'm a bit stuck and rather new! HELP! :(

share|improve this question
    
Sorry .. I think I figured out atleast partially which is good enough for a start. I will appreciate if anyone could warn me of things I may be missing (if any).I added the below to the httpd.conf file and atleast one site is up and running! <VirtualHost *:80> ServerName www.mywebsite.com ServerAlias *.mywebsite.com UseCanonicalName Off ServerAdmin admin@mywebsite.com DocumentRoot /var/www/mywebsite/ </VirtualHost> <Directory /var/www/mywebsite/> Options +FollowSymLinks AllowOverride All order allow,deny allow from all </Directory> –  user75700 Mar 24 '11 at 15:28
add comment

1 Answer

What you suggested is exactly right. The httpd.conf is not the best place to put this, you should go to:

cd /etc/apache2/sites-available

in there, copy 000-default to www.mysite.com

edit it, e.g.

vi www.mysite.com

Adjust the details as you suggested in your question (Insert)

Save (Escape, :w, enter)

Quit vi (Escape, :q,enter)

Finally, type:

a2ensite www.mysite.com

apache2ctl restart and you should have it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.