I need to do a few custom httpd.conf settings on the new box
parse all files (.html .htm .shtml) we use a lot of SSI…and with dual processors and 100 Megabit pipe with only 1 box on the router (ours) parsing all files has not caused any slow down.
set .gz compression for all pages.
add some file types to mime
Since these are site wide settings they would be made to the main httpd.conf file and not any httpd.include files for particular virtual servers/domains.
I just was curious if I can do this from the control panel. I clicked through a lot of menus and panels (probably not all) but don’t see these options.
Site-wide Apache configuration is done in the Webmin Apache module. This gives me the opportunity to point out one more source of documentation–the Webmin wiki (over 1000 printed pages of docs from both Jamie’s Webmin book and mine merged into one big wiki).
gzip (or deflate) compression (note that this prevents our Analytics module from being able to insert JavaScript bugs, I think…this won’t effect the log analyzers like Webalizer and AWStats, but will effect piwik and Google Analytics):
I don’t believe this is in the UI. You’d need to install and enable the module–mod_gzip is a non-standard module, and I don’t think it is provided by the CentOS repos (nor by us). mod_deflate, on the other hand is a standard module, and easier to use (and more compatible, since it’s been a standard a lot longer).
Basically, you’d just need to load the module, and enable it either site-wide or on a per-directory basis. If you want to make it a part of only some sub-directory on your system, you could add it to your Server Template(s) in the Apache website section.
Here’s the docs for mod_deflate (which I’d probably recommend over mod_gzip, due to its existence in the standard Apache codebase…it’ll probably be more secure and more reliable):
Bumping this topic again…are there any plans to have the compression setting options disable / enable in the module config or other module settings area?
There’s no support for mod_deflate specifically – however, you can go into Webmin -> Servers -> Apache -> Global Configuration -> Configure Apache Modules in order to enable it.
Then by default, Ubuntu (which I believe I recall you’re using) will configure Apache to compress html, text, and xml files.
If you wish to tweak the config, you can do so by editing /etc/apache2/mods-available/deflate.conf and restarting Apache.
I went in that location and I found a module called: ’ deflate ’ and checked it. Restarted apache, but according to an experienced programmer I know, the jqueries are still not zipping.
Well, remember what I mentioned above – by default on Ubuntu, it will only compress html, text, and xml files by default.
If you want it to compress more than that, you’d need to edit /etc/apache2/mods-available/deflate.conf, and add any additional mime types that you want compressed. For example, I believe the mime type for JavaScript is “application/x-javascript”.
After you add then, restart Apache, and see if that does the trick for you.
# these are known to be safe with MSIE 6
AddOutputFilterByType DEFLATE text/html text/plain text/xml
# everything else may cause problems with MSIE 6
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
AddOutputFilterByType DEFLATE application/rss+xml
Not sure if that reference is to the java is whats needed?
Also , along the same question, for compressing PHP files, is that a viable option as well? Finally, I have an old PHPBB2 bulletin board on the server and it has an option in the config / setup to gzip. Its always been OFF by default, but I just read it helps alot when turned on, but back then apache2 was not the httpd version mostly used…it was likely older versions. Would it conflict with browsers if I turned it on? Seems the settings above reference IE6, so is there a chance of causing browser incompatibility when you mess with this stuff? Thanks.
along the same question, for compressing PHP files, is that a viable option as well?
Well, you can’t compress PHP files – you can only compress the output of a PHP application. You’d need to find a way within the application (or PHP configuration) to do that.
I’ve never attempted to set that up, but you’ll see a lot of info on doing that if you search for “compress php output” on Google.
it was likely older versions. Would it conflict with browsers if I turned it on?
I’m unfortunately not really sure, I don’t have much experience in dealing with compression
I suspect most browsers would handle compression, but I really don’t know, you’d have to research and/or test that.
Seems the settings above reference IE6, so is there a chance of causing browser incompatibility when you mess with this stuff?
Sure, some browsers could have trouble handling that. If compression was good for all circumstances, it would be enabled by default.