【问题标题】:Apache2 gives 500 Internal Server ErrorApache2 给出 500 内部服务器错误
【发布时间】:2015-06-22 14:18:26
【问题描述】:

我的服务器有问题。它给出 500 内部服务器错误。

我的 domain.conf 在 sites-available 下看起来像这样:

<VirtualHost *:80>
        ServerName domain.com

        ServerAdmin hello@domain.com
        DocumentRoot /var/www/html

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

</VirtualHost>

我的 apache2.conf 看起来像这样:

<Directory />
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order deny,allow
    Allow from all
</Directory>
<Directory /var/www/html>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

我的 .htaccess 文件如下所示:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^(www\.domain\.com|188\.166\.104\.193)$ [NC]
RewriteRule (.*) http://domain.com/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

RewriteRule ^([^/]+)/$ $1.php [L]

RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php [L]

我不明白问题出在哪里。它给出 500 间隔服务器错误。

你能帮我解决这个问题吗?

最好的问候。

【问题讨论】:

  • 你也可以发布日志吗?可能是权限,但无论如何......我认为这篇文章可能属于superuser
  • 是的,.htaccess 上的 ExpiresActive 行存在问题。在这里你可以看到 .htaccess 的其余部分:pastebin.com/nYBivS4r
  • 你试过我的答案了吗?结果如何?

标签: apache .htaccess mod-rewrite


【解决方案1】:

根据您的日志:

试试这个:

a2enmod expires

ln -s /etc/apache2/mods-available/expires.load /etc/apache2/mods-enabled/

然后

service apache2 restart

【讨论】:

    猜你喜欢
    • 2016-08-31
    • 2011-08-08
    • 2015-09-30
    • 1970-01-01
    • 2023-02-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多