Skip to content

Instantly share code, notes, and snippets.

@yungke
Last active August 29, 2015 14:20
Show Gist options
  • Save yungke/b239851471369f1047c0 to your computer and use it in GitHub Desktop.
Save yungke/b239851471369f1047c0 to your computer and use it in GitHub Desktop.
個別對不同虛擬主機的配置
ModPagespeed On
ModPagespeedInheritVHostConfig on
ModPagespeedFileCachePath "/var/cache/mod_pagespeed/"
ModPagespeedEnableFilters combine_css,combine_javascript
# Direct Apache to send all HTML output to the mod_pagespeed
# output handler.
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /www/example1
ServerName www.example1.com
ModPagespeedMapRewriteDomain cdn.example1.com *example.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /www/example2
ServerName www.example2.org
ModPagespeedMapRewriteDomain cdn.example2.org *example.org
# Don't want combine_css here
ModPagespeedDisableFilters combine_css
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /www/example3
ServerName www.example3.org
# mod_pagespeed off for this virtual host
ModPagespeed Off
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin@linuxeye.com
DocumentRoot "/home/wwwroot/example.com"
ServerName example.com
ErrorLog "/home/wwwlogs/example.com_error_apache.log"
CustomLog "/dev/null" common
# mod_pagespeed off for this virtual host
ModPagespeed Off
<Directory "/home/wwwroot/example.com">
SetOutputFilter DEFLATE
Options FollowSymLinks
Require all granted
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.html index.php
</Directory>
</VirtualHost>
http {
pagespeed On;
pagespeed FileCachePath "/var/cache/ngx_pagespeed/";
pagespeed EnableFilters combine_css,combine_javascript;
server {
listen 80;
server_name www.example1.com;
root /www/example1;
pagespeed MapRewriteDomain cdn.example1.com *example.com;
}
server {
listen 80;
server_name www.example2.org;
root /www/example2;
pagespeed MapRewriteDomain cdn.example2.org *example.org;
# Don't want combine_css here
pagespeed DisableFilters combine_css;
}
server {
listen 80;
server_name www.example3.org;
root /www/example3;
# mod_pagespeed off for this virtual host
pagespeed off;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment