启用重写后 Apache2 不会重新启动

启用重写后 Apache2 不会重新启动

我在 Ubuntu 14.04.5 上。我在终端中输入启用了重写

sudo a2enmod rewrite

问题是输入后sudo service apache2 restart我得到了

 * Restarting web server apache2                                         [fail] 
 * The apache2 configtest failed.
Output of config test was:
Segmentation fault (core dumped)
Action 'configtest' failed.
The Apache error log may have more information.

000-默认

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/

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

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

错误日志

[Mon May 15 17:20:45.105432 2017] [mpm_event:notice] [pid 23318:tid 139799949780864] AH00489: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Mon May 15 17:20:45.105629 2017] [core:notice] [pid 23318:tid 139799949780864] AH00094: Command line: '/usr/sbin/apache2'
[Mon May 15 17:29:27.789501 2017] [mpm_event:notice] [pid 23318:tid 139799949780864] AH00491: caught SIGTERM, shutting down
[Mon May 15 17:29:28.862943 2017] [mpm_prefork:notice] [pid 1192] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Mon May 15 17:29:28.863087 2017] [core:notice] [pid 1192] AH00094: Command line: '/usr/sbin/apache2'
[Mon May 15 17:29:30.133713 2017] [mpm_prefork:notice] [pid 1192] AH00169: caught SIGTERM, shutting down
[Mon May 15 17:29:31.240835 2017] [mpm_prefork:notice] [pid 1278] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Mon May 15 17:29:31.240914 2017] [core:notice] [pid 1278] AH00094: Command line: '/usr/sbin/apache2'
[Mon May 15 17:31:07.210516 2017] [mpm_prefork:notice] [pid 1278] AH00169: caught SIGTERM, shutting down

答案1

打开 apache2.conf

nano /etc/apache2/apache2.conf

并将 None 更改为 All

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

然后重启Apache

service apache2 restart

注意:无需更改 000-default.conf 文件

相关内容