1

I'm trying to set up a VirtualHost on my AWS EC2 Linux server. However, it continues to direct the request to the default page.

I've installed apache and when I create an index file in /var/www/html/ it displays as expected.

However, when I add a *.conf virtual host it just reverts the default page.

I've created my /etc/httpd/conf.d/{myvhost.conf} file:

<VirtualHost *:80>
    DocumentRoot "/home/username/www/public"
    ServerName ec2-13-55-0-7.ap-southeast-2.compute.amazonaws.com

</VirtualHost>

The document root has been created at /home/username/www/public and I've added a custom index.html file, perms set to 755.

IncludeOptional conf.d/*.conf is uncommented in /etc/httpd/conf/httpd.conf

Restarted apache.

But default page is displayed and not my /home/username/www/public.
Why?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
loquela
  • 37
  • 7
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. Also see [Where do I post questions about Dev Ops?](http://meta.stackexchange.com/q/134306) – jww Jan 28 '17 at 14:09

1 Answers1

0

First it would be nice if you added some Directory directives to your root folder:

<Directory "/home/username/www/public/">
  allow from all
  Options +Indexes
</Directory>

Or (source):

<LocationMatch "^/+$">
    Options Indexes
</LocationMatch>

Second, you can debug what Apache understand of the configuration:

# Check for syntax error
apachectl -t
# List VirtualHost
apachectl -S

# both checks:
apachectl -t -D DUMP_VHOSTS

Of course, check the log files.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250