0

I've installed CentOS 6.3 with Apache 2.2 on a VM. I'm trying to set up a LAMP stack with these VirtualHosts:

  • localhost loads the path /var/www/html/
  • lcl.mydomain.com loads the path /var/www/html/dev_lcl/

In httpd.conf I added:

NameVirtualHost XXX.XXX.XXX.XXX:80

Then I added the virtualhosts.conf file:

<VirtualHost XXX.XXX.XXX.XXX:80>
    DocumentRoot /var/www/html/
    ServerName localhost
    <Directory "/var/www/html/">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    ErrorLog /var/log/httpd/error_log_localhost
    CustomLog /var/log/httpd/access_log_localhost "combined"
</VirtualHost>

<VirtualHost XXX.XXX.XXX.XXX:80>
    DocumentRoot /var/www/html/dev_lcl/
    ServerName lcl.mydomain.com
    <Directory "/var/www/html/dev_lcl/">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    ErrorLog /var/log/httpd/error_log_dev_lcl
    CustomLog /var/log/httpd/access_log_dev_lcl "combined"
</VirtualHost>

This gives me the error:

client denied by server configuration

When I remove AllowOverride All both ServerNames load, but mod_rewrite doesn't work and I need it. How can I resolve this?

2
  • Why is the same virtual hostname being used twice.... Commented Jan 9, 2013 at 21:02
  • As in "VirtualHost XXX.XXX.XXX.XXX:80"? I understood that that was how to set up multiple VirtualHosts on the same machine. Commented Jan 9, 2013 at 21:16

1 Answer 1

1

I found the solution. I had added to the .htaccess file:

order deny,allow
allow from XXX.XX.

This was causing the problem. Once I removed that it worked fine.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.