0
votes

I am new to vagrant world :-)

Using Ubuntu 15.10, VirtualBox 5.0, Vagrant 1.8.1 and Installed precise32 box

In my box I have installed Apache2, php5 and mysql as per need

Loaded Modules:

core mod_log_config mod_logio prefork http_core mod_so mod_alias mod_auth_basic mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_deflate mod_dir mod_env mod_mime mod_negotiation mod_php5 mod_reqtimeout mod_rewrite mod_setenvif mod_ssl mod_status

Enabled SSL

Vagrant VirtualHost ssl file

<IfModule mod_ssl.c>
    <VirtualHost _default_:443>
        ServerAdmin [email protected]
        ServerName mysite.com
        ServerAlias www.mysite.com
        DocumentRoot /vagrant/www

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        SSLEngine on
        SSLCertificateFile /etc/apache2/ssl/apache.crt
        SSLCertificateKeyFile /etc/apache2/ssl/apache.key
        <FilesMatch "\.(cgi|shtml|phtml|php)$">
            SSLOptions +StdEnvVars
        </FilesMatch>

        <Directory /usr/lib/cgi-bin>
            SSLOptions +StdEnvVars
        </Directory>

        BrowserMatch "MSIE [2-6]" \
            nokeepalive ssl-unclean-shutdown \
            downgrade-1.0 force-response-1.0
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
    </VirtualHost>
</IfModule>

I have tried to add the following code into my SSL VirtualHost but still in no luck :-(

<Directory "/vagrant/www">
   Options Indexes FollowSymLinks MultiViews
   AllowOverride All
   Order deny,allow
   allow from all
</Directory>

Vagrantfile config:

Vagrant.configure(2) do |config|
    config.vm.box = "precise32"
  config.vm.network "private_network", ip: "10.0.0.7"
  config.vm.synced_folder "~/myvm/www", "/vagrant_data"
end

My homepage(index.php) is working fine but the inner pages aren't opening, please suggest how to config/enable .htaccess and mod_rewrite properly in vagrant?

1

1 Answers

1
votes

For .htaccess, you need to add the AllowOverride directive under a directory tag:

<Directory "/var/www">
    AllowOverride All
</Directory>

That should do it.

EDIT

This may or may not help, but in 15.10 I believe the PPA version of apache is 2.4, which uses the Require directives:

<Directory "/vagrant/www">
   Options Indexes FollowSymLinks MultiViews
   AllowOverride All
   Order deny,allow
   allow from all
   Require all granted
</Directory>

Note the addition of Require all granted.