LoginSignup
4
4

More than 5 years have passed since last update.

mod_pagespeedをインストールする

Last updated at Posted at 2013-04-08

基本的には Installing mod_pagespeed From Packages - Make the Web Faster & Google Developers に従う

sudo yum install gperf
mkdir -p ~/bin

cd ~/bin
svn co http://src.chromium.org/svn/trunk/tools/depot_tools
export PATH=$PATH:~/bin/depot_tools

mkdir ~/mod_pagespeed
cd ~/mod_pagespeed

gclient config http://modpagespeed.googlecode.com/svn/branches/latest-beta/src
gclient sync --force --jobs=1

cd ~/mod_pagespeed/src
make BUILDTYPE=Release mod_pagespeed_test pagespeed_automatic_test

make BUILDTYPE=Release

cd ~/mod_pagespeed/src/install


APXS_BIN=/usr/local/apache22/bin/apxs MODPAGESPEED_FILE_USER=azusa BINDIR=/usr/local/apache22/bin NO_SUDO=1 sh ./install_apxs.sh
Using /usr/local/apache22/bin/apxs to determine installation location.

mod_pagespeed needs to cache optimized resources on the file system.
The default location for this cache is '/var/cache/mod_pagespeed'.
Would you like to specify a different location? (y/N) y
Location for mod_pagespeed file cache: /usr/local/apache22/cache

Preparing to install to the following locations:
/usr/local/apache22/modules/mod_pagespeed.so (azusa:azusa)
/usr/local/apache22/modules/mod_pagespeed_ap24.so (azusa:azusa)
/usr/local/apache22/bin/pagespeed_js_minify (azusa:azusa)
/usr/local/apache22/conf/pagespeed.conf (azusa:azusa)
/usr/local/apache22/conf/pagespeed_libraries.conf (azusa:azusa)
/usr/local/apache22/cache (azusa:azusa)


Continue? (y/N) y
/usr/local/apache22/cache already exists. Not creating.
Adding a load line for mod_pagespeed to /usr/local/apache22/conf/httpd.conf.
Adding a load line for pagespeed_libraries to /usr/local/apache22/conf/httpd.conf.

Installation succeeded.
Restart apache to enable mod_pagespeed.

sudo /usr/local/bin/apachectl graceful

通信がSSLの場合は、mod_pagespeedがminifyしたリソースを取得するときにhttp通信にproxyするため、httpsのドメインとのマッピングを pagespped.conf に書いてやる必要がある。

ModPagespeedMapOriginDomain http://localhost https://192.168.0.1
ModPagespeedLoadFromFile  https://192.168.0.1 /var/tomcat/webapps/

みたいな感じ。

注意点は、minifyの際にhtmlの中の必要な記述まで削ってしまい、アプリケーションが動作しなくなる場合があるので、動作確認はしっかり行う必要があるということ。このページの「インストールするだけ! お手軽サイト高速化ツール」という記述を鵜呑みする人は情弱。

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4