apache / incubator-pagespeed-cpanel

mod_pagespeed module for CPanel WHM
Other
144 stars 50 forks source link

Restricting Use of Mod_pagespeed for Domain #7

Closed Brijendrasial closed 11 years ago

Brijendrasial commented 11 years ago

Hello,

I am trying to restrict mod_pagespeed in cpanel for one of my subdomain name.

What i am actually doing is creating a virtual host as per guide here (https://developers.google.com/speed/pagespeed/module/configuration)

I have a main domain for (desktop site) and subdomain for (Mobile Site)

eg:

domain name.com (Desktop Site) m.domainname.com (Mobile Site)

So to restrict mobile site to use mod_pagespeed i am following below steps:

/ NameVirtualHost :80 / <VirtualHost :80> / DocumentRoot /home/username/public_html/m / ServerName m.domainname.com / ModPagespeed Off /

When I restarted apache i got this error

VirtualHost :80 -- mixing * ports and non- ports with a NameVirtualHost address is not supported, proceeding with undefined results

[warn] NameVirtualHost *:80 has no VirtualHosts


Now i looked inside httpd.conf file how cpanel has setup this and found it to define ip address in "NameVirtualHost" and "VirtualHost" (/usr/local/apache/conf/httpd.conf). So i changed this config to:

/ NameVirtualHost xxx.xxx.xxx.xxx:80 / / DocumentRoot /home/username/public_html/m / ServerName m.domainname.com / ModPagespeed Off /

xxx.xxx.xxx.xxx is the ip address defined inside httpd.conf for the domain m.domainname.com and "namevirtualhost" and "virtualhost" has same ip address.

Again i restarted apache and got this error:

[warn] NameVirtualHost xxx.xxx.xxx.xxx:80 has no VirtualHosts

Now the mobile site (m.domainname.com) started giving 503 error

Please help out with the correct configuration needed.

igrigorik commented 11 years ago

@Brijendrasial I'm having a hard time following the config logic here.. But, I don't think you should be modifying your core apache config -- CPanel will override it. Instead, why not just put an .htaccess file in your mobile site with "ModPagespeed Off" directive?

Brijendrasial commented 11 years ago

yes it worked, but it will be best if we can block through virtual host. isnt it?

igrigorik commented 11 years ago

The end result is exactly the same, and you shouldn't modify the files generated by CPanel.. as it will override them later and wipe your changes.

Brijendrasial commented 11 years ago

ah ok great ty. Problem solved :)