0

I can't seem to find this on google. I'm trying to put up a quick test site using EC2 and Elastic IP but I'm getting stuck at how to edit the Apache sites file so that I can view the site. It's deployed in the /var/www/ServerTest directory, and I want to access it using an Elastic IP (let's just say I want to do 56.34.123.12/index.html). How could I set this up?

Here's what I've found online so far:

    <VirtualHost *:80>
       ServerName www.example.com
       DocumentRoot /webapps/mycook/ServerTest
       <Directory /webapps/mycook/ServerTest>
           Allow from all
           Options -MultiViews
       </Directory>
    </VirtualHost>

However, I don't have a domain like "www.example.com" to link it to.

Thank you!

Rob
  • 117
  • 1
  • 4

1 Answers1

1

As I understand it, the first configured virtual host will be set as the default virtual host. If you access your server by just using the IP address and not a domain name, Apache should serve up the default virtual host.

Alternatively, you can configure a domain name in the Apache config, then on your client machine put that domain name and IP address in your host file.

You'll need to change your DocumentRoot to /var/www/ServerTest if thats where your site is.

Safado
  • 4,726
  • 7
  • 35
  • 53
  • I tired creating a vhosts.conf file in /etc/httpd and put my above code in it (minus the ServerName line) but it's still not working. Is that what you meant I should do? – Rob Oct 17 '13 at 14:18
  • Try doing `httpd -S` and see which site it lists as the default. It'll also give you the file name of where that configuration was read in from. Either modify that vhost, or put your new configuration before it. Also, did you restart Apache after making changes? And when you say it's not working, are you getting a page other than expected? Or are you getting an error message? Or what? – Safado Oct 17 '13 at 14:31
  • Ok I looked it up and found that all I had to do was modify https.conf very slightly lol super simple. Thanks so much for the help! – Rob Oct 17 '13 at 16:22