We help IT Professionals succeed at work.

Vagrant/Puphpet Apache Allow Override

SheppardDigital asked

I've started looking at Vagrant and today I've created a vagrant box using a config I've put together using puphpet.

The box seems to work fine, however for some reason .htaccess files were not working. I checked the config and Allow Override was set to All for the vhost that I'd setup, but in httpd.conf it was set to none. Once I changed this to All, the .htaccess file started working.

My question is, in the yaml.conf file is there anyway to set the apache default to Allow Override On?

Here's the relevant section of my yaml.conf file;

    install: '1'
        user: www-data
        group: www-data
        default_vhost: true
        manage_user: false
        manage_group: false
        sendfile: 0
        - rewrite
            servername: admin-interface.dev
                - admin-interface.dev
            docroot: /var/www/html/admin-interface
            port: '80'
                    provider: directory
                    path: ''
                        - Indexes
                        - FollowSymlinks
                        - MultiViews
                        - All
                        - all
                        - granted
                    custom_fragment: ''
            engine: php
            custom_fragment: ''
            ssl_cert: ''
            ssl_key: ''
            ssl_chain: ''
            ssl_certs_dir: ''
    mod_pagespeed: 0

Open in new window

I think I somehow need to set the Allow Override All in the apache > settings section as well as in the vhost section.

Is this possible? or would i have to manually need to edit the httpd.conf file to set this?
Watch Question

Have you tried copying the directories item from vhosts into "settings:" ?


I've tried moving 'directors' into settings but it generated errors when I tried to provision the VM. I moved it to beneath the main apache: section, and it didn't generate errors but it also didn't set the Allow Override option in httpd.conf.

There must be a way to do it, but Google doesn't bring anything up. I can set Allow Override for vhosts, but not the default option in httpd.conf, and without that being set to 'All' the option in each vhost is ignored. It's as if the vhosts option isn't being set at all.

The VM is running Centos. Does anyone know where I can view the vhosts file for apache? I can't seem to find it and the vhosts are not set in httpd.conf.

Here's the httpd.conf file

# Security
ServerTokens OS
ServerSignature On
TraceEnable On

ServerName "localhost"
ServerRoot "/etc/httpd"
PidFile run/httpd.pid
Timeout 120
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15

User www-data
Group www-data

AccessFileName .htaccess
<FilesMatch "^\.ht">
    Require all denied

<Directory />
  Options FollowSymLinks
  AllowOverride None

DefaultType none
HostnameLookups Off
ErrorLog "/var/log/httpd/error_log"
LogLevel warn
EnableSendfile Off

#Listen 80

Include "/etc/httpd/conf.d/*.load"
Include "/etc/httpd/conf/ports.conf"

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

IncludeOptional "/etc/httpd/conf.d/*.conf"

Open in new window

I've found a solution for the time being, during the PuPHPet configuration if you set it to use PHP_MOD then this problem doesn't occur.


Resolved myself