.htaccess of getsimple在Ubuntu Localhost上遇到500内部服务器错误

时间:2012-12-22 00:32:29

标签: apache .htaccess webserver

localhost setup

ubuntu 12.04

启用mod重写

在不同目录中运行的多个站点

dir结构

/var/www/mysite1/htdocs/
/var/www/filehostwatch.com/htdocs/
.
.
.

wordpress .htaccess在我的getimple目录中工作(出于测试原因而复制)没有问题

来自getsimple的那个给了我一个500服务器遇到了内部错误或配置错误......我后来发现这部分是错误的错误

.htacess

AddDefaultCharset UTF-8

现在导致错误的部分

Options -Indexes

# blocks direct access to the XML files - they hold all the data!
<Files ~ "\.xml$">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>
<Files sitemap.xml>
        Order allow,deny
    Allow from all
    Satisfy All
</Files>

导致500个错误的部分结尾

RewriteEngine on

# Usually it RewriteBase is just '/', but 
# replace it with your subdirectory path
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]

该站点的/ etc / apache2 / sites-enabled /中的配置文件看起来像另一个运行wordpress的站点没有问题。正如我所说的那样,来自wordpress的htaccess在复制时甚至可以在这个网站上工作。

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName filehostwatch.localhost

    DocumentRoot /var/www/filehostwatch.com/htdocs
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/filehostwatch.com/htdocs/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride FileInfo
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

知道什么可能导致这个问题吗?

2 个答案:

答案 0 :(得分:1)

您可能应该在违规部分将Satisfy All更改为Satisfy Any,看看是否有帮助。

AddDefaultCharset UTF-8

Options All -Indexes

# blocks direct access to the XML files - they hold all the data!
<Files ~ "\.xml$">
    Order deny,allow
    Deny from all
</Files>
<Files sitemap.xml>
    Satisfy Any
    Order allow,deny
    Allow from all
</Files>

RewriteEngine On

# Usually it RewriteBase is just '/', but 
# replace it with your subdirectory path
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]

答案 1 :(得分:0)

如果我正确理解您的问题... .htaccess位于您的/var/www/filehostwatch.com/htdocs/目录中?在这种情况下,我认为您没有为.htaccess文件提供足够的权限来配置您想要的内容...在虚拟主机设置中,您有:

<Directory /var/www/filehostwatch.com/htdocs/>
    ...
    AllowOverride FileInfo
    ...
</Directory>

这使得能够更改mod_rewrite设置,但不允许更改主机访问(例如Allow&amp; Deny),也不允许更改Options

您是否尝试将此设置为虚拟主机配置中的AllowOverride All?或者,您可以向AllowOverride选项添加更多指令设置。我认为AllowOverride FileInfo Limit Options可以做到这一点。

另见Apache's doc on AllowOverride