| # nginx_system_test.sh makes a few substitutions to pagespeed_test.conf.template |
| # file to generate @@TEST_TMP@@/pagespeed_test.conf |
| |
| # The cache flush test depends on worker_processes=1. |
| worker_processes 1; |
| |
| daemon @@DAEMON@@; |
| master_process @@MASTER_PROCESS@@; |
| |
| error_log "@@TEST_TMP@@/error.log" debug; |
| pid "@@TEST_TMP@@/nginx.pid"; |
| |
| events { |
| worker_connections 1024; |
| } |
| |
| |
| http { |
| access_log "@@TEST_TMP@@/access.log"; |
| |
| root "@@SERVER_ROOT@@"; |
| pagespeed UsePerVHostStatistics on; |
| |
| pagespeed CreateSharedMemoryMetadataCache "@@SHM_CACHE@@" 8192; |
| |
| # CriticalImagesBeaconEnabled is now on by default, but we disable in testing. |
| # With this option enabled, the inline image system test will currently fail. |
| # When critical image beaconing is enabled, only critical images are inlined. |
| # In our current system test, we aren't yet sending a beacon to identify the |
| # critical images to be inlined, so we just disable the option here. |
| pagespeed CriticalImagesBeaconEnabled false; |
| |
| server { |
| # Sets up a logical home-page server on |
| # max-cacheable-content-length.example.com. This server is only used to |
| # test ModPagespeedMaxCacheableContentLength, i.e., |
| # max_cacheable_response_content_length. |
| listen @@SECONDARY_PORT@@; |
| server_name max-cacheable-content-length.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| pagespeed BlockingRewriteKey psatest; |
| |
| pagespeed RewriteLevel PassThrough; |
| pagespeed EnableFilters rewrite_javascript; |
| pagespeed MaxCacheableContentLength 85; |
| } |
| |
| pagespeed UseNativeFetcher "@@NATIVE_FETCHER@@"; |
| @@RESOLVER@@ |
| |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name mpd.example.com; |
| pagespeed FileCachePath "@@SECONDARY_CACHE@@"; |
| |
| pagespeed MapProxyDomain mpd.example.com/gstatic_images |
| http://www.gstatic.com/psa/static; |
| } |
| |
| # These two vhosts are for testing the experiment framework (Furious). |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name experiment.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| pagespeed RunExperiment on; |
| pagespeed AnalyticsID "123-45-6734"; |
| pagespeed ExperimentVariable 2; |
| pagespeed ExperimentSpec |
| "id=7;enable=recompress_images;disable=convert_jpeg_to_progressive;percent=50"; |
| pagespeed ExperimentSpec "id=2;enable=recompress_images;percent=50"; |
| } |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name experiment.noga.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| pagespeed RunExperiment on; |
| pagespeed ExperimentVariable 2; |
| pagespeed ExperimentSpec |
| "id=7;enable=recompress_images;disable=convert_jpeg_to_progressive;percent=50"; |
| pagespeed ExperimentSpec "id=2;enable=recompress_images;percent=50"; |
| } |
| |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name preserveurls.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| pagespeed EnableFilters inline_preview_images,lazyload_images; |
| pagespeed EnableFilters resize_mobile_images,rewrite_images,sprite_images; |
| pagespeed EnableFilters fallback_rewrite_css_urls,flatten_css_imports; |
| pagespeed EnableFilters inline_css,move_css_above_scripts,move_css_to_head; |
| pagespeed EnableFilters outline_css,rewrite_css,combine_css; |
| pagespeed EnableFilters combine_javascript,defer_javascript; |
| pagespeed EnableFilters inline_javascript; |
| pagespeed EnableFilters outline_javascript,rewrite_javascript; |
| |
| location /mod_pagespeed_test/preserveurls/on/ { |
| pagespeed JsPreserveURLs On; |
| pagespeed ImagePreserveURLs On; |
| pagespeed CssPreserveURLs On; |
| } |
| |
| location /mod_pagespeed_test/preserveurls/off/ { |
| pagespeed JsPreserveURLs Off; |
| pagespeed ImagePreserveURLs Off; |
| pagespeed CssPreserveURLs Off; |
| } |
| } |
| |
| server { |
| # Setup a vhost with the critical image beacon and lazyload filter enabled |
| # to make sure that critical images are not lazyloaded. |
| listen @@SECONDARY_PORT@@; |
| server_name imagebeacon.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| pagespeed RewriteLevel PassThrough; |
| pagespeed EnableFilters lazyload_images; |
| pagespeed CriticalImagesBeaconEnabled true; |
| } |
| |
| server { |
| # Sets up a virtual host where we can specify forbidden filters without |
| # affecting any other hosts. |
| listen @@SECONDARY_PORT@@; |
| server_name forbidden.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| pagespeed BlockingRewriteKey psatest; |
| |
| # Start with all core filters enabled ... |
| pagespeed RewriteLevel CoreFilters; |
| # ... then forbid these filters ... |
| pagespeed ForbidFilters remove_quotes,remove_comments,collapse_whitespace; |
| pagespeed ForbidFilters rewrite_css,resize_images; |
| # ... and disable but not forbid this one (to ensure we retain its URL). |
| pagespeed DisableFilters inline_css; |
| } |
| |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name url-attribute.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| # Don't actually try to rewrite any resources; the ones in |
| # rewrite_domains.html don't actually exist. |
| pagespeed RewriteLevel PassThrough; |
| |
| # This is used for testing dynamically defined url-valued |
| # attributes |
| pagespeed UrlValuedAttribute span src Hyperlink; |
| pagespeed UrlValuedAttribute hr imgsrc Image; |
| pagespeed DomainRewriteHyperlinks on; |
| pagespeed MapRewriteDomain http://dst.example.com http://src.example.com; |
| pagespeed EnableFilters rewrite_domains; |
| pagespeed UrlValuedAttribute custom a Image; |
| pagespeed UrlValuedAttribute custom b otherResource; |
| pagespeed UrlValuedAttribute custom c hyperlink; |
| } |
| |
| server { |
| listen 127.0.0.2:@@SECONDARY_PORT@@; |
| server_name loopbackfetch.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| } |
| |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name domain-hyperlinks-on.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| # Don't actually try to rewrite any resources; the ones in |
| # rewrite_domains.html don't actually exist. |
| pagespeed RewriteLevel PassThrough; |
| |
| pagespeed DomainRewriteHyperlinks on; |
| pagespeed MapRewriteDomain http://dst.example.com http://src.example.com; |
| pagespeed EnableFilters rewrite_domains; |
| } |
| |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name domain-hyperlinks-off.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| # Don't actually try to rewrite any resources; the ones in |
| # rewrite_domains.html don't actually exist. |
| pagespeed RewriteLevel PassThrough; |
| |
| pagespeed DomainRewriteHyperlinks off; |
| pagespeed MapRewriteDomain http://dst.example.com http://src.example.com; |
| pagespeed EnableFilters rewrite_domains; |
| } |
| |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name retaincomment.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| pagespeed RetainComment " google_ad_section*"; |
| } |
| |
| server { |
| # Test host for shared memory cache. |
| listen @@SECONDARY_PORT@@; |
| server_name shmcache.example.com; |
| pagespeed FileCachePath "@@SHM_CACHE@@"; |
| |
| pagespeed RewriteLevel PassThrough; |
| pagespeed EnableFilters rewrite_images; |
| } |
| |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name xfp.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| pagespeed RespectXForwardedProto on; |
| } |
| |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name xheader.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| pagespeed XHeaderValue "UNSPECIFIED VERSION"; |
| } |
| |
| # Support for embedded configurations, where image flags in the |
| # VirtualHost serving HTML is not the same as the one serving resources, |
| # and thus we must embed the image flags in the rewritten image URLs. |
| # |
| # Note that we test with two distinct caches. |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name embed-config-html.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| root "@@SERVER_ROOT@@/mod_pagespeed_test"; |
| |
| pagespeed AddOptionsToUrls on; |
| pagespeed JpegRecompressionQuality 73; |
| pagespeed DisableFilters inline_css,extend_cache,inline_javascript; |
| pagespeed Domain embed-config-resources.example.com; |
| |
| pagespeed LoadFromFile "http://embed-config-resources.example.com/" |
| "@@SERVER_ROOT@@/mod_pagespeed_example/"; |
| } |
| |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name embed-config-resources.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| root "@@SERVER_ROOT@@/mod_pagespeed_example"; |
| |
| pagespeed AddOptionsToUrls on; |
| |
| # Note that we do not set the jpeg quality here, but take |
| # it from image URL query parameters that we synthesize in |
| # from embed-config-html.example.com. |
| |
| pagespeed LoadFromFile "http://embed-config-resources.example.com/" |
| "@@SERVER_ROOT@@/mod_pagespeed_example/"; |
| } |
| |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name respectvary.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| pagespeed RespectVary on; |
| add_header Vary User-Agent; |
| } |
| |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name cache_a.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| pagespeed CacheFlushPollIntervalSec 1; |
| pagespeed RewriteLevel PassThrough; |
| pagespeed EnableFilters inline_css; |
| } |
| |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name cache_b.example.com; |
| pagespeed FileCachePath "@@SECONDARY_CACHE@@"; |
| |
| pagespeed CacheFlushPollIntervalSec 1; |
| pagespeed RewriteLevel PassThrough; |
| pagespeed EnableFilters inline_css; |
| } |
| |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name cache_c.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| pagespeed CacheFlushFilename "othercache.flush"; |
| pagespeed CacheFlushPollIntervalSec 1; |
| pagespeed RewriteLevel PassThrough; |
| pagespeed EnableFilters inline_css; |
| } |
| |
| # The next three server blocks are for a cdn test. |
| server { |
| # Sets up a logical home-page server on www.example.com |
| listen @@SECONDARY_PORT@@; |
| server_name www.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| pagespeed LoadFromFile http://cdn.example.com @@SERVER_ROOT@@; |
| pagespeed MapRewriteDomain cdn.example.com origin.example.com; |
| pagespeed RewriteLevel PassThrough; |
| pagespeed EnableFilters rewrite_css,rewrite_images; |
| } |
| server { |
| # Sets up a logical origin for CDNs to fetch content from, on |
| # origin.example.com. |
| listen @@SECONDARY_PORT@@; |
| server_name origin.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| pagespeed LoadFromFile http://cdn.example.com @@SERVER_ROOT@@; |
| pagespeed MapRewriteDomain cdn.example.com origin.example.com; |
| pagespeed RewriteLevel PassThrough; |
| pagespeed EnableFilters rewrite_css,rewrite_images; |
| } |
| server { |
| # Sets up a logical cdn, which is where we tell browsers to fetch resources |
| # from. |
| listen @@SECONDARY_PORT@@; |
| server_name cdn.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| pagespeed LoadFromFile http://cdn.example.com @@SERVER_ROOT@@; |
| pagespeed MapRewriteDomain cdn.example.com origin.example.com; |
| pagespeed RewriteLevel PassThrough; |
| pagespeed EnableFilters rewrite_css,rewrite_images; |
| } |
| |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name tryfiles.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { } |
| location ~ "^/ngx_pagespeed_static/" { } |
| location ~ "^/ngx_pagespeed_beacon$" { } |
| |
| try_files $uri $uri/ /mod_pagespeed_example/index.html; |
| } |
| |
| server { |
| # Proxy modpagespeed.com for testing Issue 582. |
| listen @@SECONDARY_PORT@@; |
| server_name modpagespeed.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| pagespeed off; |
| |
| location / { |
| proxy_pass http://modpagespeed.com; |
| } |
| } |
| |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name notransform.example.com; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| pagespeed RewriteLevel PassThrough; |
| pagespeed EnableFilters rewrite_images; |
| |
| add_header Cache-Control no-transform; |
| } |
| |
| server { |
| listen @@SECONDARY_PORT@@; |
| server_name blocking.example.com; |
| pagespeed FileCachePath "@@SECONDARY_CACHE@@"; |
| |
| pagespeed BlockingRewriteKey psatest; |
| pagespeed RewriteLevel PassThrough; |
| pagespeed EnableFilters rewrite_images; |
| } |
| |
| server { |
| listen @@PRIMARY_PORT@@; |
| server_name localhost; |
| pagespeed FileCachePath "@@FILE_CACHE@@"; |
| |
| location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { |
| add_header "" ""; |
| } |
| |
| # uncomment the following two lines if you're testing memcached |
| #pagespeed MemcachedServers "localhost:11211"; |
| #pagespeed MemcachedThreads 1; |
| |
| pagespeed on; |
| |
| #pagespeed CacheFlushPollIntervalSec 1; |
| |
| #pagespeed RunExperiment on; |
| #pagespeed AnalyticsID "UA-XXXXXXXX-Y"; |
| #pagespeed ExperimentSpec "id=1;percent=50;default"; |
| #pagespeed ExperimentSpec "id=2;percent=50"; |
| |
| pagespeed Library 43 1o978_K0_LNE5_ystNklf |
| http://www.modpagespeed.com/rewrite_javascript.js; |
| |
| # If X-PSA-Blocking-Rewrite request header is present and its value matches |
| # the value of BlockingRewriteKey below, the response will be fully |
| # rewritten before being flushed to the client. |
| pagespeed BlockingRewriteKey psatest; |
| |
| # Disable parsing if the size of the HTML exceeds 50kB. |
| pagespeed MaxHtmlParseBytes 50000; |
| |
| add_header X-Extra-Header 1; |
| |
| # Establish a proxy mapping where the current server proxies an image |
| # stored on ref.pssdemos.com. |
| pagespeed MapProxyDomain localhost:@@PRIMARY_PORT@@/gstatic_images |
| http://www.gstatic.com/psa/static; |
| |
| location /ngx_pagespeed_statistics { |
| allow 127.0.0.1; |
| deny all; |
| } |
| |
| location /ngx_pagespeed_message { |
| allow 127.0.0.1; |
| deny all; |
| } |
| |
| pagespeed Domain modpagespeed.com:1023; |
| |
| location /mod_pagespeed_test/forbid_all_disabled/disabled { |
| # Prevent the enabling of these filters for files in this directory |
| # -and- all subdirectories. |
| # |
| # Apache checks here that they can't be renabled with .htaccess, but |
| # that's not how Nginx location blocks work. |
| pagespeed ForbidAllDisabledFilters true; |
| pagespeed DisableFilters remove_quotes,remove_comments; |
| pagespeed DisableFilters collapse_whitespace; |
| } |
| |
| location ~ \.php$ { |
| fastcgi_param SCRIPT_FILENAME $request_filename; |
| fastcgi_param QUERY_STRING $query_string; |
| fastcgi_param REQUEST_METHOD $request_method; |
| fastcgi_param CONTENT_TYPE $content_type; |
| fastcgi_param CONTENT_LENGTH $content_length; |
| fastcgi_pass 127.0.0.1:9000; |
| } |
| |
| location /mod_pagespeed_example/core_filters/ { |
| pagespeed RewriteLevel CoreFilters; |
| } |
| |
| location /mod_pagespeed_example/pass_through/ { |
| pagespeed RewriteLevel PassThrough; |
| } |
| |
| #location / { |
| # proxy_pass http://www.google.com; |
| #} |
| |
| location /mod_pagespeed_test/ssi/ { |
| ssi on; |
| |
| pagespeed EnableFilters collapse_whitespace,remove_comments,combine_css; |
| pagespeed DisableFilters add_instrumentation; |
| pagespeed DisableFilters inline_css; |
| } |
| |
| location /mod_pagespeed_test/no_cache/ { |
| add_header Cache-Control no-cache; |
| } |
| |
| location /mod_pagespeed_test/compressed/ { |
| add_header Content-Encoding gzip; |
| |
| # Even though this is also in the server block it must be repeated here |
| # because add_header directives are only inherited if you don't define |
| # more of them. See: http://serverfault.com/questions/400197 |
| add_header X-Extra-Header 1; |
| |
| types { |
| text/javascript custom_ext; |
| } |
| } |
| |
| location /mod_pagespeed_test/shard/ { |
| pagespeed ShardDomain "localhost:@@PRIMARY_PORT@@" shard1,shard2; |
| pagespeed RewriteLevel PassThrough; |
| pagespeed EnableFilters extend_cache; |
| } |
| |
| location /mod_pagespeed_test/retain_cache_control/ { |
| pagespeed ModifyCachingHeaders off; |
| add_header Cache-Control "private, max-age=3000"; |
| } |
| |
| location /mod_pagespeed_test/avoid_renaming_introspective_javascript__on/ { |
| pagespeed AvoidRenamingIntrospectiveJavascript on; |
| } |
| |
| location /mod_pagespeed_test/custom_options/ { |
| pagespeed DisableFilters convert_jpeg_to_progressive; |
| } |
| |
| pagespeed EnableFilters remove_comments; |
| |
| # Test LoadFromFile mapping by mapping one dir to another. |
| pagespeed LoadFromFile |
| "http://localhost:@@PRIMARY_PORT@@/mod_pagespeed_test/load_from_file/web_dir/" |
| "@@SERVER_ROOT@@/mod_pagespeed_test/load_from_file/file_dir/"; |
| pagespeed LoadFromFileMatch |
| "^http://localhost:@@PRIMARY_PORT@@/mod_pagespeed_test/load_from_file_match/web_([^/]*)/" |
| "@@SERVER_ROOT@@/mod_pagespeed_test/load_from_file/file_\1/"; |
| pagespeed LoadFromFileRule Disallow |
| "@@SERVER_ROOT@@/mod_pagespeed_test/load_from_file/file_dir/httponly/"; |
| pagespeed LoadFromFileRuleMatch Disallow \.ssp.css$; |
| pagespeed LoadFromFileRuleMatch Allow exception\.ssp\.css$; |
| |
| #charset koi8-r; |
| |
| #access_log logs/host.access.log main; |
| |
| index index.html; |
| |
| |
| #error_page 404 /404.html; |
| |
| # redirect server error pages to the static page /50x.html |
| # |
| error_page 500 502 503 504 /50x.html; |
| location = /50x.html { |
| root html; |
| } |
| } |
| |
| sendfile on; |
| |
| keepalive_timeout 65; |
| |
| # set up gzip |
| gzip on; |
| gzip_vary on; |
| # Turn on gzip for all content types that should benefit from it. |
| gzip_types application/ecmascript; |
| gzip_types application/javascript; |
| gzip_types application/json; |
| gzip_types application/pdf; |
| gzip_types application/postscript; |
| gzip_types application/x-javascript; |
| gzip_types image/svg+xml; |
| gzip_types text/css; |
| gzip_types text/csv; |
| # "gzip_types text/html" is assumed. |
| gzip_types text/javascript; |
| gzip_types text/plain; |
| gzip_types text/xml; |
| |
| gzip_http_version 1.0; |
| |
| types { |
| text/html html htm shtml; |
| text/css css; |
| text/xml xml; |
| image/gif gif; |
| image/jpeg jpeg jpg; |
| application/x-javascript js; |
| application/atom+xml atom; |
| application/rss+xml rss; |
| |
| text/mathml mml; |
| text/plain txt; |
| text/vnd.sun.j2me.app-descriptor jad; |
| text/vnd.wap.wml wml; |
| text/x-component htc; |
| |
| image/png png; |
| image/tiff tif tiff; |
| image/vnd.wap.wbmp wbmp; |
| image/x-icon ico; |
| image/x-jng jng; |
| image/x-ms-bmp bmp; |
| image/svg+xml svg svgz; |
| image/webp webp; |
| |
| application/java-archive jar war ear; |
| application/mac-binhex40 hqx; |
| application/msword doc; |
| application/pdf pdf; |
| application/postscript ps eps ai; |
| application/rtf rtf; |
| application/vnd.ms-excel xls; |
| application/vnd.ms-powerpoint ppt; |
| application/vnd.wap.wmlc wmlc; |
| application/vnd.google-earth.kml+xml kml; |
| application/vnd.google-earth.kmz kmz; |
| application/x-7z-compressed 7z; |
| application/x-cocoa cco; |
| application/x-java-archive-diff jardiff; |
| application/x-java-jnlp-file jnlp; |
| application/x-makeself run; |
| application/x-perl pl pm; |
| application/x-pilot prc pdb; |
| application/x-rar-compressed rar; |
| application/x-redhat-package-manager rpm; |
| application/x-sea sea; |
| application/x-shockwave-flash swf; |
| application/x-stuffit sit; |
| application/x-tcl tcl tk; |
| application/x-x509-ca-cert der pem crt; |
| application/x-xpinstall xpi; |
| application/xhtml+xml xhtml; |
| application/zip zip; |
| |
| application/octet-stream bin exe dll; |
| application/octet-stream deb; |
| application/octet-stream dmg; |
| application/octet-stream eot; |
| application/octet-stream iso img; |
| application/octet-stream msi msp msm; |
| |
| audio/midi mid midi kar; |
| audio/mpeg mp3; |
| audio/ogg ogg; |
| audio/x-m4a m4a; |
| audio/x-realaudio ra; |
| |
| video/3gpp 3gpp 3gp; |
| video/mp4 mp4; |
| video/mpeg mpeg mpg; |
| video/quicktime mov; |
| video/webm webm; |
| video/x-flv flv; |
| video/x-m4v m4v; |
| video/x-mng mng; |
| video/x-ms-asf asx asf; |
| video/x-ms-wmv wmv; |
| video/x-msvideo avi; |
| } |
| default_type application/octet-stream; |
| |
| } |