Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
Why is the same virtual hostname being used twice.... –  mdpc Jan 9 '13 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. –  r00tAcc3ss Jan 9 '13 at 21:16
add comment

1 Answer 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.

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.