2017-03-11 28 views
-1

我有一个篝火设置和运行良好。它在http://office.barrecertification.com/突然服务器恢复到以前的备份我得到内部服务器错误。我的.htaccess文件是与codeignitor篝火内部服务器错误

# Helpful sections not specific to CodeIgniter - excerpted from 
# https://github.com/h5bp/server-configs/ 

# ---------------------------------------------------------------------- 
# Proper MIME type for all files 
# ---------------------------------------------------------------------- 

<IfModule mod_mime.c> 

    # JavaScript 
    # Normalize to standard type (it's sniffed in IE anyways) 
    # tools.ietf.org/html/rfc4329#section-7.2 
    AddType application/javascript js jsonp 
    AddType application/json json 

    # Audio 
    AddType audio/mp4 m4a f4a f4b 
    AddType audio/ogg oga ogg 

    # Video 
    AddType video/mp4 mp4 m4v f4v f4p 
    AddType video/ogg ogv 
    AddType video/webm webm 
    AddType video/x-flv flv 

    # SVG 
    # Required for svg webfonts on iPad 
    # twitter.com/FontSquirrel/status/14855840545 
    AddType image/svg+xml svg svgz 
    AddEncoding gzip svgz 

    # Webfonts 
    AddType application/font-woff woff 
    AddType application/vnd.ms-fontobject eot 
    AddType application/x-font-ttf ttf ttc 
    AddType font/opentype otf 

    # Assorted types 
    AddType application/octet-stream safariextz 
    AddType application/x-chrome-extension crx 
    AddType application/x-opera-extension oex 
    AddType application/x-shockwave-flash swf 
    AddType application/x-web-app-manifest+json webapp 
    AddType application/x-xpinstall xpi 
    AddType application/xml rss atom xml rdf 
    AddType image/webp webp 
    AddType image/x-icon ico 
    AddType text/cache-manifest appcache manifest 
    AddType text/vtt vtt 
    AddType text/x-component htc 
    AddType text/x-vcard vcf 

</IfModule> 


# ---------------------------------------------------------------------- 
# Gzip compression 
# ---------------------------------------------------------------------- 

<IfModule mod_deflate.c> 

    # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/ 
    <IfModule mod_setenvif.c> 
    <IfModule mod_headers.c> 
     SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ 

HAVE_Accept-Encoding 
     RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding 
    </IfModule> 
    </IfModule> 

    # Compress all output labeled with one of the following MIME-types 
    # (for Apache versions below 2.3.7, you don't need to enable `mod_filter` 
    # and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines as 
    # `AddOutputFilterByType` is still in the core directives) 
    <IfModule mod_filter.c> 
    AddOutputFilterByType DEFLATE application/atom+xml \ 
            application/javascript \ 
            application/json \ 
            application/rss+xml \ 
            application/vnd.ms-fontobject \ 
            application/x-font-ttf \ 
            application/xhtml+xml \ 
            application/xml \ 
            font/opentype \ 
            image/svg+xml \ 
            image/x-icon \ 
            text/css \ 
            text/html \ 
            text/plain \ 
            text/x-component \ 
            text/xml 
    </IfModule> 

</IfModule> 


# ---------------------------------------------------------------------- 
# UTF-8 encoding 
# ---------------------------------------------------------------------- 

# Use UTF-8 encoding for anything served text/plain or text/html 
AddDefaultCharset utf-8 

# Force UTF-8 for a number of file formats 
<IfModule mod_mime.c> 
    AddCharset utf-8 .atom .css .js .json .rss .vtt .xml 
</IfModule> 


# ---------------------------------------------------------------------- 
# A little more security 
# ---------------------------------------------------------------------- 

# To avoid displaying the exact version number of Apache being used, add the 
# following to httpd.conf (it will not work in .htaccess): 
# ServerTokens Prod 

# "-Indexes" will have Apache block users from browsing folders without a 
# default document Usually you should leave this activated, because you 
# shouldn't allow everybody to surf through every folder on your server (which 
# includes rather private places like CMS system folders). 
<IfModule mod_autoindex.c> 
    Options -Indexes 
</IfModule> 

# Block access to "hidden" directories or files whose names begin with a 
# period. This includes directories used by version control systems such as 
# Subversion or Git. 
<IfModule mod_rewrite.c> 
    RewriteCond %{SCRIPT_FILENAME} -d [OR] 
    RewriteCond %{SCRIPT_FILENAME} -f 
    RewriteRule "(^|/)\." - [F] 
</IfModule> 

# Block access to backup and source files. These files may be left by some 
# text/html editors and pose a great security danger, when anyone can access 
# them. 
<FilesMatch "(^#.*#|\.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|sw[op])|~)$"> 
    Order allow,deny 
    Deny from all 
    Satisfy All 
</FilesMatch> 


# ---------------------------------------------------------------------- 
# Start rewrite engine 
# ---------------------------------------------------------------------- 

# Turning on the rewrite engine is necessary for the following rules and features. 
# FollowSymLinks must be enabled for this to work. 

<IfModule mod_rewrite.c> 
    Options +FollowSymlinks 
    RewriteEngine On 

    # If you installed Bonfire in a subfolder, you will need to 
    # change the following line to match the subfolder you need. 
    # http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase 
    RewriteBase/

    # Removes access to the system folder by users. 
    # Additionally this will allow you to create a System.php controller, 
    # previously this would not have been possible. 
    # 'system' can be replaced if you have renamed your system folder. 
RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_URI} ^bonfire/codeigniter.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 
</IfModule> 

# Rewrite "www.example.com -> example.com" 

<IfModule mod_rewrite.c> 
    RewriteCond %{HTTPS} !=on 
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] 
    RewriteRule^http://%1%{REQUEST_URI} [R=301,L] 
</IfModule> 



# Checks to see if the user is attempting to access a valid file, 
# such as an image or css document, if this isn't true it sends the 
# request to index.php 

<IfModule mod_rewrite.c> 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php?/$1 [L] 
</IfModule> 


<IfModule !mod_rewrite.c> 
    # If we don't have mod_rewrite installed, all 404's 
    # can be sent to index.php, and everything works as normal. 
    # Submitted by: ElliotHaughin 

    ErrorDocument 404 index.php 
</IfModule> 
<IfModule pagespeed_module> 
    ModPagespeed off 
</IfModule> 

它安装在http://barrecertification.com/office其用作office.barrecetification.com一个子域。

这根diretory

# BEGIN WordPress 
    <IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/
    RewriteRule ^index\.php$ - [L] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ /index.php?/$1 [QSA,L] 


    #----- START DAP ----- 
    RewriteCond %{REQUEST_FILENAME} -f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} (.*)/wp-content/uploads/(.*) 
    RewriteCond %{REQUEST_FILENAME} !(.*)(\.php|\.css|\.js|\.jpg|\.gif|\.png|\.txt|\.ico|\.jpeg)$ 
    RewriteRule (.*) /dap/client/website/dapclient.php?dapref=%{REQUEST_URI}&plug=wp&%{QUERY_STRING} [L] 
    #----- END DAP ----- 


    # TN Expires Caching Start # 

    ExpiresActive On 
    ExpiresByType text/css "access 1 month" 
    ExpiresByType text/html "access 1 month" 
    ExpiresByType image/gif "access 1 year" 
    ExpiresByType image/png "access 1 year" 
    ExpiresByType image/jpg "access 1 year" 
    ExpiresByType image/jpeg "access 1 year" 
    ExpiresByType image/x-icon "access 1 year" 
    ExpiresByType application/pdf "access 1 month" 
    ExpiresByType application/javascript "access 1 month" 
    ExpiresByType text/x-javascript "access 1 month" 
    ExpiresByType application/x-shockwave-flash "access 1 month" 
    ExpiresDefault "access 1 month" 

    # TN Expires Caching End # 
    </IfModule> 

# END WordPress 

# php -- BEGIN cPanel-generated handler, do not edit 
# NOTE this account's php is controlled via FPM and the vhost, this is a place holder. 
# Do not edit. This next line is to support the cPanel php wrapper (php_cli). 
# AddType application/x-httpd-ea-php70 .php .phtml 
# php -- END cPanel-generated handler, do not edit 

<IfModule pagespeed_module> 
    ModPagespeed off 
</IfModule> 

我不能明白为什么它正在发生任何线索的的.htaccess。 您可以请帮忙

+0

_“无法得到任何线索为什么会发生”__ - 你在哪里寻找线索?如果您的服务器错误日志_first_在500的情况下是绝对最低的结果,我希望您的研究能够解决如何处理内部服务器错误的问题 - 那么哪里出错? – CBroe

+0

我没有aceess到Apache日志,所以我不能检查它 –

+0

可以重写模块被关闭,我不能通过print_r(apache_get_modules())检查它;因为它的PHP是FastCGI –

回答

1

当您无法访问error.log文件时,您始终可以设置本地wampxampp服务器。这或多或少是我所做的,来测试并看看发生了什么。


在你的情况下,该错误信息是

[核心:警报] [PID 10504] [客户:: 1:57830]在/ var/WWW/htaccess的测试/办公室/。 htaccess的:缺少envariable表达式SetEnvIfNoCase

看着SetEnvIfNoCase

Syntax: SetEnvIfNoCase attribute regex [!]env-variable[=value] [[!]env-variable[=value]] ... 

并将其与该指令在.htaccess文件

SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ 

显示,有两种说法,其中需要至少三个。 attributeregex在那里,但没有定义环境变量。


当我第一次看这个问题,我错过下面SetEnvIfNoCase

SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ 

HAVE_Accept-Encoding 

行了,当我加入这两条线,就成了

SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding 

和错误消失(至少在我的环境中)。

+0

可以请你解释它我不明白你的解决方案 –

+0

错误信息解释哪个指令是负责'500内部服务器错误'。负责的指令是“SetEnvIfNoCase”。要修复500错误,您必须修复'SetEnvIfNoCase'。 –