mod_rewrite не работает в бродяге

Я новичок в мире бродяг :-)

Использование Ubuntu 15.10, VirtualBox 5.0, Vagrant 1.8.1 и установленного блока precise32

В моей коробке я установил Apache2, php5 и mysql по мере необходимости.

Загруженные модули:

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

Включен SSL

SSL-файл Vagrant VirtualHost

<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>

Я попытался добавить следующий код в свой SSL VirtualHost, но все равно безуспешно :-(

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

Конфигурация Vagrantfile:

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

Моя домашняя страница (index.php) работает нормально, но внутренние страницы не открываются, подскажите, как правильно настроить/включить .htaccess и mod_rewrite в vagrant?


person zarpio    schedule 03.04.2016    source источник


Ответы (1)


Для .htaccess вам нужно добавить директиву AllowOverride под тегом каталога:

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

Это должно сработать.

ИЗМЕНИТЬ

Это может помочь или не помочь, но в 15.10 я считаю, что версия apache PPA - 2.4, которая использует директивы Require:

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

Обратите внимание на добавление Require all granted.

person Brian Brownton    schedule 03.04.2016
comment
Я пробовал, но мне не повезло, пожалуйста, посмотрите мой пересмотренный вопрос и подскажите, как я могу решить эту проблему? Спасибо - person zarpio; 04.04.2016
comment
@zarpio обновил мой ответ. Если это не сработает, у меня закончились идеи! - person Brian Brownton; 04.04.2016