Jump to content

PageSpeed Web Server Module


Recommended Posts

  • 4 months later...
  • Replies 90
  • Created
  • Last Reply

Great post! I will try pagespeed. What do you think about "static assets" under a tpmfs partition besides FileCachePath? It's a different kind of cache, right?

So the question is: does it worth to set it in tpmfs and how much space should be allocated to it?

On pagespeed documentation there is nothing about using tpfms for this cache.

Configuring the location of static assets

Several filters, including defer_javascript and lazyload_images, require external resources that must be loaded from somewhere. Before 1.8.31.2, mod_pagespeed would load these files from /mod_pagespeed_static while ngx_pagespeed would load them from /ngx_pagespeed_static. In 1.8.31.2 the default was changed to /pagespeed_static for both platforms and a directive was added to make the path configurable:

Apache:
ModPagespeedStaticAssetPrefix /custom/static/
Nginx:
pagespeed StaticAssetPrefix /custom/static/;

Link to comment
Share on other sites

I also have seen that pagespeed could work well together with Varnish. There is a tutorial in pagespeed documentation for it:

Configuring Varnish servers

This section describes the steps for configuring Varnish 3.x to work with a PageSpeed server running with the DownstreamCache* directives. Note that the configuration below allows caching of four versions for each HTML page corresponding to the most popular User-Agent classes.

Setting up Varnish servers: Varnish can be set up using the following steps.
sudo apt-get install varnish
Edit /etc/default/varnish and configure the port on which the Varnish server should listen. A sample set of lines to add at the end of the file are:
  DAEMON_OPTS="-a :80 
             -T localhost:6082 
             -f /etc/varnish/default.vcl 
             -S /etc/varnish/secret 
             -s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G"
The /etc/varnish/default.vcl file contains the Varnish server configuration. You should update the backend default block to reflect the correct upstream PageSpeed server host and port. A sample configuration is:
# Block 1: Define upstream server's host and port.
backend default {
  # Location of PageSpeed server.
  .host = "127.0.0.1";
  .port = "8080";
}
To start the Varnish server after making any changes to the default.vcl file, use the following command:
sudo service varnish restart
Building the User-Agent based key for hashing into the cache: In order to make sure that the cache stores different versions of the HTML based on whatever optimizations are possible with the given User-Agents, the below subroutine with User-Agent based logic should be defined.
# Block 2: Define a key based on the User-Agent which can be used for hashing.
# Also set the PS-CapabilityList header for PageSpeed server to respect.
sub generate_user_agent_based_key {
    # Define placeholder PS-CapabilityList header values for large and small
    # screens with no UA dependent optimizations. Note that these placeholder
    # values should not contain any of ll, ii, dj, jw or ws, since these
    # codes will end up representing optimizations to be supported for the
    # request.
    set req.http.default_ps_capability_list_for_large_screens = "LargeScreen.SkipUADependentOptimizations:";
    set req.http.default_ps_capability_list_for_small_screens = "TinyScreen.SkipUADependentOptimizations:";

    # As a fallback, the PS-CapabilityList header that is sent to the upstream
    # PageSpeed server should be for a large screen device with no browser
    # specific optimizations.
    set req.http.PS-CapabilityList = req.http.default_ps_capability_list_for_large_screens;

    # Cache-fragment 1: Desktop User-Agents that support lazyload_images (ll),
    # inline_images (ii) and defer_javascript (dj).
    # Note: Wget is added for testing purposes only.
    if (req.http.User-Agent ~ "(?i)Chrome/|Firefox/|Gecko|MSIE |Trident|Safari|Wget") {
      set req.http.PS-CapabilityList = "ll,ii,dj:";
    }
    # Cache-fragment 2: Desktop User-Agents that support lazyload_images (ll),
    # inline_images (ii), defer_javascript (dj), webp (jw) and lossless_webp
    # (ws).
    if (req.http.User-Agent ~
        "(?i)Chrome/[2][3-9]+.|Chrome/[[3-9][0-9]+.|Chrome/[0-9]{3,}.") {
      set req.http.PS-CapabilityList = "ll,ii,dj,jw,ws:";
    }
    # Cache-fragment 3: This fragment contains (a) Desktop User-Agents that
    # match fragments 1 or 2 but should not because they represent older
    # versions of certain browsers or bots and (b) Tablet User-Agents that
    # on all browsers and use image compression qualities applicable to large
    # screens. Note that even Tablets that are capable of supporting inline or
    # webp images, e.g. Android 4.1.2, will not get these advanced
    # optimizations.
    if (req.http.User-Agent ~ "(?i)Firefox/[1-2].|MSIE [5-8].|bot|Yahoo!|Ruby|RPT-HTTPClient|(Google (+https://developers.google.com/+/web/snippet/))|Android|iPad|TouchPad|Silk-Accelerated|Kindle Fire") {
      set req.http.PS-CapabilityList = req.http.default_ps_capability_list_for_large_screens;
    }
    # Cache-fragment 4: Mobiles and small screen Tablets will use image compression
    # qualities applicable to small screens, but all other optimizations will be
    # those that work on all browsers.
    if (req.http.User-Agent ~ "(?i)Mozilla.*Android.*Mobile*|iPhone|BlackBerry|Opera Mobi|Opera Mini|SymbianOS|UP.Browser|J-PHONE|Profile/MIDP|portalmmm|DoCoMo|Obigo|Galaxy Nexus|GT-I9300|GT-N7100|HTC One|Nexus [4|7|S]|Xoom|XT907") {
      set req.http.PS-CapabilityList = req.http.default_ps_capability_list_for_small_screens;
    }
    # Remove placeholder header values.
    remove req.http.default_ps_capability_list_for_large_screens;
    remove req.http.default_ps_capability_list_for_large_screens;
}
Note that the logic above allows for four classes of User-Agents to be cached. If you do not have webp related optimizations enabled on your PageSpeed server, you can drop the first cache-fragment block. If you do not have other User-Agent dependent filters such as inline_images, inline_preview_images, lazyload_images and defer_javascript enabled on your server, you can drop the second cache-fragment. Finally, if you do not have separate image compression qualities defined for small screens, you can drop the fourth cache-fragment.

The PS-CapabilityList header being set in the subroutine will be subsequently used for computing the cache key. It is also sent to the PageSpeed server as an indication of the optimizations that will be supported by the associated cache-fragment.

Redefine the cache key hash: The vcl_hash method needs to be redefined to incorporate the PS-CapabilityList header value into the cache key hash as given below:
sub vcl_hash {
  # Block 3: Use the PS-CapabilityList value for computing the hash.
  hash_data(req.http.PS-CapabilityList);
}
Define an ACL for purge: An ACL needs to be defined for accepting purge requests. A sample ACL definition is:
# Block 3a: Define ACL for purge requests
acl purge {
  # Purge requests are only allowed from localhost.
  "localhost";
  "127.0.0.1";
  "YOUR-SERVER-IP";
}
Redefine hit/miss handlers for purge requests: vcl_hit and vcl_miss should be redefined to process purge requests and issue purges. Sample redefinitions are:
# Block 3b: Issue purge when there is a cache hit for the purge request.
sub vcl_hit {
  if (req.request == "PURGE") {
    purge;
    error 200 "Purged.";
  }
}

# Block 3c: Issue a no-op purge when there is a cache miss for the purge
# request.
sub vcl_miss {
  if (req.request == "PURGE") {
     purge;
     error 200 "Purged.";
  }
}
Generate the User-Agent based key: vcl_recv is the entry point for every request to the cache. It should be redefined to call the subroutine responsible for generating the User-Agent based key to be used for computing the cache key hash. Purge requests also need to be processed here and forwarded to one of vcl_hit or vcl_miss.
# Block 4: In vcl_recv, on receiving a request, call the method responsible for
# generating the User-Agent based key for hashing into the cache.

sub vcl_recv {
  call generate_user_agent_based_key;
  # Block 3d: Verify the ACL for an incoming purge request and handle it.
  if (req.request == "PURGE") {
    if (!client.ip ~ purge) {
      error 405 "Not allowed.";
    }
    return (lookup);
  }
  # Blocks which decide whether cache should be bypassed or not go here.
}
Bypassing the cache for certain requests: Requests for .pagespeed. resources are set to bypass the cache since these are already cached in the PageSpeed server. Adding these to the cache would cause bloating due to identical copies of the same resource getting cached in different User-Agent fragments.
  # Block 5a: Bypass the cache for .pagespeed. resource. PageSpeed has its own
  # cache for these, and these could bloat up the caching layer.
  if (req.url ~ ".pagespeed.([a-z].)?[a-z]{2}.[^.]{10}.[^.]+") {
    # Skip the cache for .pagespeed. resource.  PageSpeed has its own
    # cache for these, and these could bloat up the caching layer.
    return (pass);
  }
Request headers other than User-Agent can also alter the response sent by the backend server. For example, the Accept-Encoding header dictates whether the response will be gzipped or not.
  # Block 5b: Only cache responses to clients that support gzip.  Most clients
  # do, and the cache holds much more if it stores gzipped responses.
  if (req.http.Accept-Encoding !~ "gzip") {
    return (pass);
  }
Cookies or source IP addresses could also influence the content served by your backend server. You should check for any such request headers to which your backend server is sensitive and consider incorporating these into the caching logic, by either adding them to the cache key or by bypassing the cache entirely.
Respecting Cache-Control and Content-Type response headers: If your backend server already serves cacheable HTML with appropriate Cache-Control headers, the max-age values will be respected by Varnish. However, these responses still need to be served with Cache-Control: no-cache, max-age=0. You can do this by redefining vcl_fetch as shown below:
# Block 6: Mark HTML uncacheable by caches beyond our control.
sub vcl_fetch {
   if (beresp.http.Content-Type ~ "text/html") {
     # Hide the upstream cache control header.
     remove beresp.http.Cache-Control;
     # Add no-cache Cache-Control header for html.
     set beresp.http.Cache-Control = "no-cache, max-age=0";
   }
   return (deliver);
}
Record hits/misses in response headers: vcl_deliver can be redefined to output a response header that indicates whether the response was a cache hit or cache miss. A sample redefinition is:
# Block 7: Add a header for identifying cache hits/misses.
sub vcl_deliver {
  if (obj.hits > 0) {
    set resp.http.X-Cache = "HIT";
  } else {
    set resp.http.X-Cache = "MISS";
  }
}

Is this simple configuration enough for IPS or it needs more customization?

Link to comment
Share on other sites

I cannot access the pagespeed admin that is set just like the tutorial:

<Location /pagespeed_admin>
   Order allow,deny
   Allow from localhost
   Allow from 127.0.0.1
   Allow from XXX.XXX.XXX.XX
   SetHandler pagespeed_admin
</Location>

IPS gives a Error 404. How to solve it?

Link to comment
Share on other sites

  • 3 weeks later...

theres a little bit of difference between nginx and apache, mostly just spaces and apache seems to not like stacking in one line

heres one for apache based on this example, I do have 2 commented out as I have not had chance to test them.

# Attempt to load mod_version if it wasn't loaded or compiled in (eg on Debian)
<IfModule !mod_version.c>
LoadModule version_module /usr/lib64/httpd/modules/mod_version.so
</IfModule>

<IfVersion < 2.4>
LoadModule pagespeed_module /usr/lib64/httpd/modules/mod_pagespeed.so
</IfVersion>
<IfVersion >= 2.4.2>
LoadModule pagespeed_module /usr/lib64/httpd/modules/mod_pagespeed_ap24.so
</IfVersion>

# Only attempt to load mod_deflate if it hasn't been loaded already.
<IfModule !mod_deflate.c>
LoadModule deflate_module /usr/lib64/httpd/modules/mod_deflate.so
</IfModule>
<IfModule pagespeed_module>

ModPagespeed on

ModPagespeedFileCachePath "/var/cache/mod_pagespeed/"

ModPagespeedFileCacheSizeKb 1048576

ModPagespeedFileCacheCleanIntervalMs 3600000

ModPagespeedCreateSharedMemoryMetadataCache "/var/cache/mod_pagespeed/" 65536

ModPagespeedRewriteLevel PassThrough

ModPagespeedEnableFilters combine_css
ModPagespeedEnableFilters rewrite_javascript
ModPagespeedEnableFilters lazyload_images
ModPagespeedEnableFilters convert_jpeg_to_progressive
ModPagespeedEnableFilters extend_cache
ModPagespeedEnableFilters insert_dns_prefetch
ModPagespeedEnableFilters collapse_whitespace
ModPagespeedEnableFilters rewrite_css
ModPagespeedEnableFilters combine_javascript
ModPagespeedEnableFilters remove_comments
ModPagespeedEnableFilters convert_meta_tags
ModPagespeedEnableFilters convert_to_webp_lossless
ModPagespeedEnableFilters rewrite_style_attributes_with_url
ModPagespeedEnableFilters insert_image_dimensions


# ModPagespeedEnableFilters defer_javascript

# NOTE SPCE BETWEEN "

ModPagespeedLoadFromFile "http://yourdomain.com/public/" "/YOUR-PATHS//public_html/public/"

ModPagespeedLoadFromFile "http://yourdomain.com/cache/" "/YOUR-PATHS//public_html/cache/"

ModPagespeedLoadFromFile "http://yourdomain.com/uploads/" "/YOUR-PATHS//public_html/uploads/"

ModPagespeedLoadFromFile "http://yourdomain.com/screenshots/" "/YOUR-PATHS//public_html/screenshots/"

ModPagespeedDisallow "http://yourdomain.com/admin/*"

ModPagespeedDisallow "http://yourdomain.com/*do=quote*"

# ModPagespeedDisallow "http://example.org/page/index.html"

EDIT: I have not done the virtual directory stuff for the monitor page yet so just left that out.

Kirito has, IMO, gotten a really good baseline here that seems to work very well.

Link to comment
Share on other sites

After enabling defer_javascript, some users complain that the following code is added to their messages automatically (I mean, the text below shows up inside the post, as part of the message text):

<script type="text/javascript" src="/pagespeed_static/js_defer.eX_CQDtaZA.js"></script>

Anyone facing similar issues? Any ideas on how to solve this? I disabled defer_javascript for now.

Link to comment
Share on other sites

After enabling defer_javascript, some users complain that the following code is added to their messages automatically (I mean, the text below shows up inside the post, as part of the message text):

[...]

Anyone facing similar issues? Any ideas on how to solve this? I disabled defer_javascript for now.

Disallow

There are some pages and resources you'll want to disallow PageSpeed access to.


    pagespeed Disallow     "https://example.org/admin/*";
    pagespeed Disallow     "https://example.org/*do=quote*";
    pagespeed Disallow     "https://example.org/page/index.html";

First is your admin directory. If you use a renamed admin directory, change this setting appropriately. PageSpeed does not seem to cause anything in the AdminCP to break or glitch, but there's really no reason you need it to run on pages here. It's best to just leave it off.



Second is required if you want to use the defer_javascript filter. When quoting a post on IP.Board, the editor makes an ajax call to a page that returns HTML output. If you do not stop PageSpeed from applying filters to this page, your users will have a bunch of gibberish Javascript code plastered into the editor every time they try and quote a post. This issue took me a decent while to track down. Quite annoying, but very easy to fix.

Lastly, I disable the filter for my IP.Content homepage. This is because deferring javascript makes things a bit glitchy with the gallery slideshow, and trying to work around it with pagespeed_no_defer attributes is a headache. If you don't use the gallery slider on your IP.Content homepage, you can probably safely remove this line.





Again, this is just the configuration I've tuned so far and the configuration I used on my production forums. Don't expect it to be a perfect configuration for your forum or server. To learn more about PageSpeed and to learn how to fine tune things specifically to your liking, the web server module is very well documented, just

dive in

and start learning.



Please feel free to offer feedback on my configuration here, as well as offer your own tips and suggestions, or just post your general experience with using the PageSpeed module on your forums.

Link to comment
Share on other sites

don't know if it will help anyone but this is setup I have been using with apache for last few days and it seems to work well.

do know I need to do some js work still though and I do want to "neaten" it by segregating it as much as possible by function.

figured I would post it in case it may help someone.

ModPagespeed on

ModPagespeedFileCachePath "/var/cache/mod_pagespeed/"

ModPagespeedFileCacheSizeKb 1048576

ModPagespeedFileCacheCleanIntervalMs 3600000

ModPagespeedCreateSharedMemoryMetadataCache "/var/cache/mod_pagespeed/" 65536

ModPagespeedRewriteLevel PassThrough
ModPagespeedEnableFilters local_storage_cache
ModPagespeedEnableFilters combine_css
ModPagespeedEnableFilters rewrite_javascript
ModPagespeedEnableFilters lazyload_images
ModPagespeedEnableFilters convert_jpeg_to_progressive
ModPagespeedEnableFilters extend_cache
ModPagespeedEnableFilters insert_dns_prefetch
ModPagespeedEnableFilters collapse_whitespace
ModPagespeedEnableFilters rewrite_css
ModPagespeedEnableFilters combine_javascript
ModPagespeedEnableFilters remove_comments
ModPagespeedEnableFilters convert_meta_tags
ModPagespeedEnableFilters convert_to_webp_lossless
ModPagespeedEnableFilters rewrite_style_attributes_with_url
ModPagespeedEnableFilters insert_image_dimensions
ModPagespeedEnableFilters convert_png_to_jpeg
ModPagespeedEnableFilters recompress_jpeg
ModPagespeedEnableFilters dedup_inlined_images
ModPagespeedImageMaxRewritesAtOnce 8
ModPagespeedEnableFilters rewrite_images
ModPagespeedForceCaching on
ModPagespeedEnableFilters move_css_above_scripts
ModPagespeedEnableFilters move_css_to_head
ModPagespeedEnableFilters combine_css
ModPagespeedEnableFilters fallback_rewrite_css_urls
ModPagespeedEnableFilters rewrite_javascript
ModPagespeedEnableFilters collapse_whitespace
ModPagespeedEnableFilters prioritize_critical_css
ModPagespeedEnableFilters inline_css
ModPagespeedEnableFilters extend_cache_pdfs
ModPagespeedEnableFilters rewrite_css,sprite_images
ModPagespeedEnableFilters elide_attributes
ModPagespeedEnableFilters trim_urls
ModPagespeedEnableFilters inline_preview_images
ModPagespeedEnableFilters resize_mobile_images
ModPagespeedEnableFilters canonicalize_javascript_libraries

# DISABLED FOR NOW PLACED IT TO REMIND ME TO LOOK INTO THIS FOR CDN
# ModPagespeedMapProxyDomain target_domain/subdir
# origin_domain/subdir [rewrite_domain/subdir]


# DISABLED UNTIL I TROUBLESHOOT
# ModPagespeedEnableFilters defer_javascript



# NOTE SPACE BETWEEN " "

ModPagespeedLoadFromFile "http://yourdomain.com/public/" "/YOUR-PATHS//public_html/public/"

ModPagespeedLoadFromFile "http://yourdomain.com/cache/" "/YOUR-PATHS//public_html/cache/"

ModPagespeedLoadFromFile "http://yourdomain.com/uploads/" "/YOUR-PATHS//public_html/uploads/"

ModPagespeedLoadFromFile "http://yourdomain.com/screenshots/" "/YOUR-PATHS//public_html/screenshots/"

ModPagespeedDisallow "http://yourdomain.com/admin/*"

ModPagespeedDisallow "http://yourdomain.com/*do=quote*"

# ModPagespeedDisallow "http://example.org/page/index.html"

Link to comment
Share on other sites

I mentioned this elsewhere, but I thought I should add it here for other people to know. If you use the >LazyLoader hook, you will need to disable it, as it doesn't work together with pagespeed; however since pagespeed already adds its own lazyloader, this is a non-issue.

You mentioned a /screenshots directory, however I don't see this directory on my IPB installation.

As for the metadata cache: "As of 1.7.30.1 this cache is enabled by default." However you may configure its size with the new option DefaultSharedMemoryCacheKB. So:

pagespeed CreateSharedMemoryMetadataCache "/run/shm/ngx_pagespeed/" 65536;

Should be replaced with:

pagespeed DefaultSharedMemoryCacheKB 65535;

Have you played with the UseNativeFetcher directive? According to documentation, this improves DNS fetches by 10%, and you can set a DNS server that is within your network.

Now, when I enable pagespeed, a few things are not working. The "Moderate Topic" function; when we click to mark a post to be moderate, the pop-up window doesn't show up; and the @Mentions hook. Still investigating this, pointers are appreciated.

Thanks.

Link to comment
Share on other sites

that metadatashared MAY have been left over from older install, have been running it for some time with stock install settings and started tweaking few days ago. I'll fix that.

have not looked into UseNativeFetcher yet.

the moderate function works with mine so not sure why you see this issue, however right now I am NOT using any cdn and all served direct from site and not over cdn.

possibly your js is on cdn?

Link to comment
Share on other sites

this is one I have been using for about 6 hours that seems to be working well, I did correct the metadata a few moments ago.

its important that minify be turned OFF in acp.

# GENERAL AND MISC ModPagespeedRewriteLevel PassThrough ModPagespeedEnableFilters elide_attributes ModPagespeedEnableFilters trim_urls ModPagespeedEnableFilters insert_dns_prefetch ModPagespeedEnableFilters convert_meta_tags ModPagespeedInPlaceResourceOptimization on ModPagespeedEnableFilters in_place_optimize_for_browser # CACHE SECTION ModPagespeedFileCachePath "/var/cache/mod_pagespeed/" ModPagespeedFileCacheSizeKb 1048576 ModPagespeedFileCacheCleanIntervalMs 3600000 ModPagespeedDefaultSharedMemoryCacheKB 65535 ModPagespeedFileCacheInodeLimit 500000 ModPagespeedEnableFilters local_storage_cache ModPagespeedForceCaching on ModPagespeedEnableFilters extend_cache ModPagespeedEnableFilters extend_cache_pdfs ModPagespeedFetchWithGzip on SetOutputFilter DEFLATE ModPagespeedLRUCacheKbPerProcess 1024 ModPagespeedLRUCacheByteLimit 16384 # CSS SECTION ModPagespeedEnableFilters combine_css ModPagespeedEnableFilters move_css_above_scripts ModPagespeedEnableFilters move_css_to_head ModPagespeedEnableFilters combine_css ModPagespeedEnableFilters fallback_rewrite_css_urls ModPagespeedEnableFilters collapse_whitespace ModPagespeedEnableFilters rewrite_css ModPagespeedEnableFilters collapse_whitespace ModPagespeedEnableFilters prioritize_critical_css ModPagespeedEnableFilters inline_css ModPagespeedEnableFilters rewrite_css,sprite_images ModPagespeedEnableFilters remove_comments # JS SECTION # DISABLED UNTIL I TROUBLESHOOT ModPagespeedEnableFilters defer_javascript ModPagespeedEnableFilters rewrite_javascript ModPagespeedEnableFilters combine_javascript ModPagespeedEnableFilters canonicalize_javascript_libraries ModPagespeedEnableFilters rewrite_javascript # IMAGES SECTION ModPagespeedEnableFilters convert_to_webp_lossless ModPagespeedEnableFilters rewrite_style_attributes_with_url ModPagespeedEnableFilters insert_image_dimensions ModPagespeedEnableFilters convert_png_to_jpeg ModPagespeedEnableFilters recompress_jpeg ModPagespeedEnableFilters dedup_inlined_images ModPagespeedImageMaxRewritesAtOnce 8 ModPagespeedEnableFilters rewrite_images ModPagespeedEnableFilters lazyload_images ModPagespeedEnableFilters convert_jpeg_to_progressive ModPagespeedEnableFilters inline_preview_images ModPagespeedEnableFilters resize_mobile_images # PATHING-SHARD-DOMAIN SECTION # NOTE SPACE BETWEEN " # DISABLED UNTIL I CHECK IT OUT ModPagespeedMapProxyDomain target_domain/subdir # DISABLED UNTIL I CHECK IT OUT origin_domain/subdir [rewrite_domain/subdir]

ModPagespeed on












































































Link to comment
Share on other sites

Hi,

I had to disable defer_javascript. The main reason is that for the two days we left it enabled, the revenue from our ad networks dropped tremendously. If the lost was minimal, I'd prefer to leave it on and fine tune it and iron out all the bugs. However, since the drop was significant, we simply can't leave it on.

We don't use CDN.

Our users were also complaining about the flash uploader. So right now page_speed is completely disabled. Let me know what you find out about this issue.

Should we disable the minify JavaScript option? What is the rationale here?

As for the NativeFetch, I was using:

pagespeed UseNativeFetcher on;
resolver a.b.c.d;
Where a.b.c.d is the IP address of the DNS server closest to your server.

Thanks,

Gabriel.

Link to comment
Share on other sites

If defer javascript is causing you problems you can simply disable the filter.

Generally, you should just be using your datacenters internal DNS servers, instead of a third party.

Most scripts your IP.Board installation uses should already be minified, but there may be some that aren't, especially if they were added by third party applications/hooks. This option shouldn't often cause you problems.

Link to comment
Share on other sites

Gabriel can you post your nginx one, leaving paths and urls removed of course.
I swapped from apache to nginx and am pretty sure we had close configs, would save me bunch of time vs copy/pasting all the nginx names.

only one item on the server (an owncloud setup) has issues with nginx so going to use it, will delete some stuff and use dropbox if I cannot get owncloud css working right. but I digress..

thanks

Link to comment
Share on other sites

DMacleo, they are on the first post of this topic... I have it disabled right now... Anyway, my config was as follows. I hope it helps. I added it at /usr/local/nginx/conf/nginx.conf at the http section:

#ngx_pagespeed
pagespeed On;
pagespeed FileCachePath "/var/cache/ngx_pagespeed/";
pagespeed DefaultSharedMemoryCacheKB 65536;
pagespeed RewriteLevel PassThrough;
pagespeed EnableFilters combine_css,combine_javascript,collapse_whitespace,extend_cache,insert_dns_prefetch,remove_comments,rewrite_css,rewrite_style_attributes_with_url,rewrite_javascript,convert_to_webp_lossless,convert_jpeg_to_progressive,insert_image_dimensions,lazyload_images,defer_javascript,convert_meta_tags;
pagespeed LoadFromFile "http://***/public/"
                       "/***/public/";
pagespeed LoadFromFile "http://***/cache/"
                       "/***/cache/";
pagespeed LoadFromFile "http://***/uploads/"
                       "/***/uploads/";
pagespeed Disallow     "http://***/admin/*";
pagespeed Disallow     "http://***/*do=quote*";
pagespeed UseNativeFetcher on;
resolver x.x.x.x;
NOTE: The original instructions present on this topic explain how to use a ramdisk to store the cache. I didn't go that far, but I highly suggest you to take a look into that.
Link to comment
Share on other sites

I had to swap back to apache with nginx proxy for now :(

turns out the owncloud issue was more important than I thought, I will be trying to fix that this week and will try those settings.

thanks.

fwiw I saw no performance gains from straight nginx vs apache 2.4.10 with nginx proxy with few hundred online.

wanted to go nginx for microcaching benefits as well but not sure I am going to be able to :(

Link to comment
Share on other sites

I didn't get to check that as much as I wanted but quick checks ram usage seemed real close.

that was with 300 +/- on the ipb site and 400 or so (so approx 700 on server) streaming video from clipbucket site.

now I did need ram drop when I went straight apache to spache/nginx proxy using php-fpm (apache mpm event) so I suspect I MAY be seeing pretty close to what I would see if I used straight nginx.

if I could get the owncloud issues fixed I will try and test again.

off topic, anyone that uses dropbox and pays really should take a look at owncloud.

unless they run nginx on a directadmin server.....

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.

  • Upcoming Events

    No upcoming events found
×
×
  • Create New...