logo superhost
logo superhost

Khuyến mãi mới

Chưa có khuyến mãi mới
Xem tất cả

Thông báo mới

SuperHost không có tin mới
Quý khách không có tin mới
Xem tất cả
  • Trang chủ
  • Danh mục  
    • Tất cả danh mục
    • -----
    • Cloud Server
    • Hosting Linux
    • Business Hosting
    • Super Hosting
    • SEO Hosting
    • Reseller Hosting
    • Dedicated Server
    • Colocations
    • Backup Services
    • Chứng thư số SSL
    • Email theo tên miền
    • License Services
    • Quản trị máy chủ
    • Hosting miễn phí
    • Đăng ký tên miền
    • Chuyển tên miền
  • Câu hỏi thường gặp
  •   Gửi hỗ trợ
      • Việt Nam
      • English
  • Tài khoản  
    • Đăng nhập
    • Quản lý mã khuyến mãi
    • Quản lý CMND và GPKD
    • Quản lý VAT
    • Đăng ký
    • -----
    • Quên mật khẩu
  1. Trang khách hàng
  2. Câu hỏi thường gặp
  3. Quản lý VPS
  4. Hướng dẫn cài đặt mod_pagespeed trên VPS Cpanel

  Thư mục

0
AAPanel
1
Almalinux
13
Bảo mật
28
Cloud Server
1
CyberPanel
17
Cơ sở dữ liệu MySQL
9
Datasheet
31
Dịch vụ Hosting
34
Dịch vụ máy chủ riêng
11
Dịch vụ đại lý hosting
3
DirectAdmin
3
FTP
20
Hướng dẫn E-mail
6
Hướng dẫn thanh toán
26
Khuyến mãi
2
Lập trình PHP
45
Lỗi nhỏ thường gặp
98
Quản lý VPS
2
Qui định & Chính sách
5
Reset mật khẩu
4
Sao lưu dữ liệu
11
Sử dụng .htaccess
7
Sử dụng Kloxo
16
Sử dụng mControl
12
Sử dụng Trung tâm KH
8
Sử dụng Wordpress
4
SEO Hosting
12
Tên miền
1
Tuyển dụng
10
Upload website
3
Video hướng dẫn

  Thư mục

Hướng dẫn cài đặt mod_pagespeed trên VPS Cpanel

Bước 1: Tải mod_pagespeed

cd /usr/local/src/
mkdir mod_pagespeed
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_x86_64.rpm

Bước 2: Giải nén và phân quyền:

rpm2cpio mod-pagespeed-beta_current_x86_64.rpm | cpio -idmv
cp usr/lib64/httpd/modules/mod_pagespeed.so /usr/local/apache/modules/
chmod 755 /usr/local/apache/modules/mod_pagespeed.so

Bước 3: Tạo thư mục chứa mod_pagespeed

mkdir -p /var/mod_pagespeed/
chown nobody:nobody /var/mod_pagespeed/

Bước 4: Build thêm mod_deflate

/usr/local/apache/bin/apxs -c -i /home/cpeasyapache/src/httpd-version/modules/filters/mod_deflate.c

Bước 5: Tạo file pagespeed.conf trong thư mục /usr/local/apache/ và paste đoạn config sau:

LoadModule pagespeed_module modules/mod_pagespeed.so

# Only attempt to load mod_deflate if it hasn't been loaded already.
<IfModule !mod_deflate.c>
LoadModule deflate_module modules/mod_deflate.so
</IfModule>
<IfModule pagespeed_module>
# Turn on mod_pagespeed. To completely disable mod_pagespeed, you
# can set this to "off".
ModPagespeed on

# Direct Apache to send all HTML output to the mod_pagespeed
# output handler.
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html

# The ModPagespeedFileCachePath and
# ModPagespeedGeneratedFilePrefix directories must exist and be
# writable by the apache user (as specified by the User
# directive).
ModPagespeedFileCachePath "/var/mod_pagespeed/cache/"
ModPagespeedGeneratedFilePrefix "/var/mod_pagespeed/files/"

# Override the mod_pagespeed 'rewrite level'. The default level
# "CoreFilters" uses a set of rewrite filters that are generally
# safe for most web pages. Most sites should not need to change
# this value and can instead fine-tune the configuration using the
# ModPagespeedDisableFilters and ModPagespeedEnableFilters
# directives, below. Valid values for ModPagespeedRewriteLevel are
# PassThrough, CoreFilters and TestingCoreFilters.
#
# ModPagespeedRewriteLevel PassThrough

# Explicitly disables specific filters. This is useful in
# conjuction with ModPagespeedRewriteLevel. For instance, if one
# of the filters in the CoreFilters needs to be disabled for a
# site, that filter can be added to
# ModPagespeedDisableFilters. This directive contains a
# comma-separated list of filter names, and can be repeated.
#
# ModPagespeedDisableFilters rewrite_images

# Explicitly enables specific filters. This is useful in
# conjuction with ModPagespeedRewriteLevel. For instance, filters
# not included in the CoreFilters may be enabled using this
# directive. This directive contains a comma-separated list of
# filter names, and can be repeated.
#
# ModPagespeedEnableFilters rewrite_javascript,rewrite_css
# ModPagespeedEnableFilters collapse_whitespace,elide_attributes

# ModPagespeedDomain
# authorizes rewriting of JS, CSS, and Image files found in this
# domain. By default only resources with the same origin as the
# HTML file are rewritten. For example:
#
# ModPagespeedDomain cdn.myhost.com
#
# This will allow resources found on http://cdn.myhost.com to be
# rewritten in addition to those in the same domain as the HTML.
#
# Wildcards (* and ?) are allowed in the domain specification. Be
# careful when using them as if you rewrite domains that do not
# send you traffic, then the site receiving the traffic will not
# know how to serve the rewritten content.

# Other defaults (cache sizes and thresholds):
#
# ModPagespeedFileCacheSizeKb 102400
# ModPagespeedFileCacheCleanIntervalMs 3600000
# ModPagespeedLRUCacheKbPerProcess 1024
# ModPagespeedLRUCacheByteLimit 16384
# ModPagespeedCssInlineMaxBytes 2048
# ModPagespeedImageInlineMaxBytes 2048
# ModPagespeedCssImageInlineMaxBytes 2048
# ModPagespeedJsInlineMaxBytes 2048
# ModPagespeedCssOutlineMinBytes 3000
# ModPagespeedJsOutlineMinBytes 3000

# Bound the number of images that can be rewritten at any one time; this
# avoids overloading the CPU. Set this to 0 to remove the bound.
#
# ModPagespeedImageMaxRewritesAtOnce 8

# Settings for image optimization:
#
# Jpeg recompression quality (0 to 100, -1 strips metadata):
# ModPagespeedJpegRecompressionQuality -1
#
# Percent of original image size below which optimized images are retained:
# ModPagespeedImageLimitOptimizedPercent 100
#
# Percent of original image area below which image resizing will be
# attempted:
# ModPagespeedImageLimitResizeAreaPercent 100

# When Apache is set up as a browser proxy, mod_pagespeed can record
# web-sites as they are requested, so that an image of the web is built up
# in the directory of the proxy administrator's choosing. When ReadOnly is
# on, only files already present in the SlurpDirectory are served by the
# proxy.
#
# ModPagespeedSlurpDirectory ...
# ModPagespeedSlurpReadOnly on

# The maximum URL size is generally limited to about 2k characters
# due to IE: See http://support.microsoft.com/kb/208427/EN-US.
# Apache servers by default impose a further limitation of about
# 250 characters per URL segment (text between slashes).
# mod_pagespeed circumvents this limitation, but if you employ
# proxy servers in your path you may need to re-impose it by
# overriding the setting here. The default setting is 1024
# characters.
#
# ModPagespeedMaxSegmentLength 250

# Uncomment this if you want to prevent mod_pagespeed from combining files
# (e.g. CSS files) across paths
#
# ModPagespeedCombineAcrossPaths off

# Explicitly tell mod_pagespeed to load some resources from disk.
# This will speed up load time and update frequency.
#
# This should only be used for static resources which do not need
# specific headers set or other processing by Apache.
#
# Both URL and filesystem path should specify directories and
# filesystem path must be absolute (for now).
#
# ModPagespeedLoadFromFile "http://example.com/static/" "/var/www/static/"

# Enables server-side instrumentation and statistics. If this rewriter is
# enabled, then each rewritten HTML page will have instrumentation javacript
# added that sends latency beacons to /mod_pagespeed_beacon. These
# statistics can be accessed at /mod_pagespeed_statistics. You must also
# enable the mod_pagespeed_statistics and mod_pagespeed_beacon handlers
# below.
#
# ModPagespeedEnableFilters add_instrumentation

# Uncomment the following line so that ModPagespeed will not cache or
# rewrite resources with Vary: in the header, e.g. Vary: User-Agent.
# ModPagespeedRespectVary on

# This handles the client-side instrumentation callbacks which are injected
# by the add_instrumentation filter.
# You can use a different location by adding the ModPagespeedBeaconUrl
# directive; see the documentation on add_instrumentation.
<Location /mod_pagespeed_beacon>
SetHandler mod_pagespeed_beacon
</Location>

# Uncomment the following line if you want to disable statistics entirely.
#
# ModPagespeedStatistics off

# This page lets you view statistics about the mod_pagespeed module.
<Location /mod_pagespeed_statistics>
Order allow,deny
# You may insert other "Allow from" lines to add hosts you want to
# allow to look at generated statistics. Another possibility is
# to comment out the "Order" and "Allow" options from the config
# file, to allow any client that can reach your server to examine
# statistics. This might be appropriate in an experimental setup or
# if the Apache server is protected by a reverse proxy that will
# filter URLs in some fashion.
Allow from localhost
Allow from 127.0.0.1
SetHandler mod_pagespeed_statistics
</Location>

# Page /mod_pagespeed_message lets you view the latest messages from
# mod_pagespeed, regardless of log-level in your httpd.conf
# ModPagespeedMessageBufferSize is the maximum number of bytes you would
# like to dump to your /mod_pagespeed_message page at one time,
# its default value is 100k bytes.
# Set it to 0 if you want to disable this feature.

ModPagespeedMessageBufferSize 100000

# mod_pagespeed has the ability to collect statistics about page visits as
# well as page, resource, and div location (see div_structure_filter)
# referrals. These will eventually be used to speed up pages with at least
# resource pre-fetch, if not Chrome's new pre-render, technology. See
# googlewebmastercentral.blogspot.com/2011/06/announcing-instant-pages.html
# We recommend enabling the div_structure filter if turning on statistics
# collection below. Enabling the div_structure filter will increase the
# effectiveness of pre-rendering prediction, because it will take into
# account both URLs and page locations when aggregating user click through
# behavior. To enable the div_structure filter, uncomment the appropriate
# line below or add div_structure to the enabled filters at the top of this
# configuration file.
# Page /mod_pagespeed_referer_statistics lets you view the accumulated
# referral statistics.
# ModPagespeedCollectRefererStatistics on enables collection (default off)
# ModPagespeedHashRefererStatistics obscures collected info (default off)
# ModPagespeedRefererStatisticsOutputLevel can be changed if the page
# /mod_pagespeed_referer_statistics is slow to load:
# - Organized (default) is the most readable and ordered logically, but
# involves computation
# - Simple is readable but unordered
# - Fast is the fastest and contains all necessary information, but is
# fairly unreadable

# ModPagespeedCollectRefererStatistics on
# ModPagespeedHashRefererStatistics on
# ModPagespeedRefererStatisticsOutputLevel Simple
# ModPagespeedEnableFilters div_structure

<Location /mod_pagespeed_message>
Allow from localhost
Allow from 127.0.0.1
SetHandler mod_pagespeed_message
</Location>
<Location /mod_pagespeed_referer_statistics>
Allow from localhost
Allow from 127.0.0.1
SetHandler mod_pagespeed_referer_statistics
</Location>
</IfModule>

Bước 6: Include file config pagespeed.conf vào pre_main_global.conf.

Bước 7: Restart lại apache và kiểm tra lại bằng lệnh: httpd -M

 

Chúc các bạn thành công!

© 2011 SuperHost

 

 

Câu trả lời này hữu ích?

 In nội dung này

Bài viết liên quan

View: 13264
Cấu hình RAM cho OpenVZ

Cấp phát RAM trong nền tảng ảo hóa OpenVZ phụ thuộc vào 3 tham số chính là: kmemsize: khuyến...

View: 19184
Hướng dẫn reboot VPS qua giao diện Web

Bước 1: bạn truy cập vào trung tâm khách hàng theo link sau:...

View: 23170
Hướng dẫn xem các thông tin của VPS bằng lệnh SSH

1. Kiểm tra lượng CPU: Sử dụng lệnh: cat /proc/cpuinfo - Dòng "processor" sẽ cho biết...

View: 12688
Máy chủ ảo - VPS là gì?

1. VPS là gì? Máy chủ ảo (Virtual Private Server - VPS) là phương pháp phân chia một máy chủ...

View: 24068
các lệnh cơ bản của SSH

1. Lệnh liên quan đến hệ thống exit: thoát khỏi cửa sổ dòng lệnh.logout: tương tự exit.reboot:...

Powered by WHMCompleteSolution

SuperHost logo
CÔNG TY TNHH SUPERHOST
  Tòa nhà số 104, Đường số 6, KDC CityLand Park Hills, P.10, Q.Gò Vấp, Tp.Hồ Chí Minh
  sales@superhost.vn
  (028) - 73002073
SuperHost
Giới thiệu doanh nghiệp
Liên hệ
Cổng thanh toán
Blog
Tuyển dụng
Qui định sử dụng
Chính sách hoàn tiền
DỊCH VỤ
Linux Hosting
Domain
Dedicated Server
Cloud Server
SSL Certificates
Website
Colocation
CÔNG CỤ
Abuse IP – Báo cáo IP
Kiểm tra IP máy tính
SSL Checker
Tạo Key và CSR cho SSL
Kiểm tra email tồn tại
SuperHost logo
© SuperHost 2011 All Rights Reserved.   (Đường dây nóng) 0931150780, (Tổng đài) (028) - 73002073

Title

Loading...
Loading...
LiveZilla Live Help
Chát với chúng tôi