2017-08-02 11 views
1

角度cli-Angular 4(ng build --prod --bo)でアプリを作成し、https://armen.jahanbani.ir/にアップロードしました。角度4、litespeed cpanelを使用した応答ヘッダーでのgzip圧縮なし

.htaccessを使ってgzip圧縮を有効にするためのすべての可能なコードを試しましたが、いずれも機能しませんでした。ここで

は、これまでのところ、私の.htaccessです:

accept-ranges:bytes 
cache-control:public, max-age=604800 
content-length:1343404 
content-type:application/javascript 
date:Wed, 02 Aug 2017 14:16:00 GMT 
expires:Wed, 09 Aug 2017 14:16:00 GMT 
last-modified:Wed, 02 Aug 2017 12:20:30 GMT 
server:LiteSpeed 
status:200 

そしてリクエストヘッダ:

<IfModule mod_deflate.c> 
    # Compress HTML, CSS, JavaScript, Text, XML and fonts 
    AddOutputFilterByType DEFLATE application/javascript 
    AddOutputFilterByType DEFLATE application/rss+xml 
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject 
    AddOutputFilterByType DEFLATE application/x-font 
    AddOutputFilterByType DEFLATE application/x-font-opentype 
    AddOutputFilterByType DEFLATE application/x-font-otf 
    AddOutputFilterByType DEFLATE application/x-font-truetype 
    AddOutputFilterByType DEFLATE application/x-font-ttf 
    AddOutputFilterByType DEFLATE application/x-javascript 
    AddOutputFilterByType DEFLATE application/xhtml+xml 
    AddOutputFilterByType DEFLATE application/xml 
    AddOutputFilterByType DEFLATE font/opentype 
    AddOutputFilterByType DEFLATE font/otf 
    AddOutputFilterByType DEFLATE font/ttf 
    AddOutputFilterByType DEFLATE image/svg+xml 
    AddOutputFilterByType DEFLATE image/x-icon 
    AddOutputFilterByType DEFLATE text/css 
    AddOutputFilterByType DEFLATE text/html 
    AddOutputFilterByType DEFLATE text/javascript 
    AddOutputFilterByType DEFLATE text/plain 
    AddOutputFilterByType DEFLATE text/xml 

    # Remove browser bugs (only needed for really old browsers) 
    BrowserMatch ^Mozilla/4 gzip-only-text/html 
    BrowserMatch ^Mozilla/4\.0[678] no-gzip 
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html 
    Header append Vary User-Agent 
</IfModule> 



## EXPIRES CACHING ## 
<IfModule mod_expires.c> 
ExpiresActive On 
ExpiresByType image/jpg "access plus 1 year" 
ExpiresByType image/jpeg "access plus 1 year" 
ExpiresByType image/gif "access plus 1 year" 
ExpiresByType image/png "access plus 1 year" 
ExpiresByType text/css "access plus 1 month" 
ExpiresByType application/pdf "access plus 1 month" 
ExpiresByType text/x-javascript "access plus 1 month" 
ExpiresByType application/x-shockwave-flash "access plus 1 month" 
ExpiresByType image/x-icon "access plus 1 year" 
ExpiresDefault "access plus 2 days" 
</IfModule> 
## EXPIRES CACHING ## 





RewriteEngine On 
# If an existing asset or directory is requested go to it as it is 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR] 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d 
RewriteRule^- [L] 

# If the requested resource doesn't exist, use index.html 
RewriteRule^/index.html 

は、ここに私のレスポンスヘッダーです

:authority:armen.jahanbani.ir 
:method:GET 
:path:/main.17622fc4e9e5f19aa68d.bundle.js 
:scheme:https 
accept:*/* 
accept-encoding:gzip, deflate, br 
accept-language:en-US,en;q=0.8,fa;q=0.6 
alexatoolbar-alx_ns_ph:AlexaToolbar/alx-4.0.1 
cache-control:no-cache 
pragma:no-cache 
referer:https://armen.jahanbani.ir/home 
user-agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 

私もファイルを圧縮するために、サーバーを強制しようとしましたHeader append content-encoding: gzipを追加しても、どちらもうまくいかず、エラーが発生しました。

私は.htaccessとサーバーで作業する必要がありますか、または角度ファイルに問題がありますか?

ありがとうございました

+0

Apache httpd.confファイルにアクセスできますか? –

+0

残念ながら、httpd.confにアクセスすることはできません。メインドメインはWordPress経由で作成され、正常に動作します!他に何かがないと思う。 –

答えて

0

WebAdminからgzipを直接有効にしましたか?圧縮可能なタイプを追加するだけで、gzipをこのようにセットアップする方が簡単です。

+0

はい、gzipを有効にしようとしましたが、動作しませんでした。私は正確に何が間違っているのか分からない。簡単に言えば、私はWordpressのWebサイトで.htaccessの手法を使用しています。 –

関連する問題