我可以使用Nginx的PageSpeed模块和SSI一起吗?

是否可以将Nginx的PageSpeed模块与SSI一起使用?

启用PageSpeed后无法启动并运行SSI。

但是,只要我禁用PageSpeed,SSI再次工作:

location ~ .+\.html$ { pagespeed off; ssi on; } 

我发现这个问题的解决方法。

 server { listen 80; server_name app.local www.app.local; access_log /var/log/nginx/www.app.local.access.log; error_log /var/log/nginx/www.app.local.error.log; index index.html index.htm; autoindex off; # Set the root directory to search for the file root /home/deploy/app-directory/production; # ------------------------------------------------------------------------------------ # @begin CONFIGURE PAGESPEED # Needs to exist and be writable by nginx. Use tmpfs for best performance. pagespeed FileCachePath /var/ngx_pagespeed_cache; # Ensure requests for pagespeed optimized resources go to the pagespeed handler # and no extraneous headers get set. location ~ "\.pagespeed\.([az]\.)?[az]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; } location ~ "^/pagespeed_static/" { } location ~ "^/ngx_pagespeed_beacon$" { } location /ngx_pagespeed_statistics { allow 127.0.0.1; deny all; } location /ngx_pagespeed_global_statistics { allow 127.0.0.1; deny all; } location /ngx_pagespeed_message { allow 127.0.0.1; deny all; } location /pagespeed_console { allow 127.0.0.1; deny all; } pagespeed LoadFromFileMatch "^https?://(www.)?app.local" "/home/deploy/app-directory/production/"; # Disable CoreFilters # pagespeed RewriteLevel PassThrough; # Enable filters # pagespeed EnableFilters combine_css,extend_cache,flatten_css_imports,rewrite_images,prioritize_critical_css,remove_comments; # @end CONFIGURE PAGESPEED # ------------------------------------------------------------------------------------ # ... # Proxy html requests to a server located on port 90 # This is a workarround to get PageSpeed working together with SSI location ~ ^/[^/]+\.html$ { pagespeed on; proxy_pass http://127.0.0.1:90$uri; # proxy_pass http://127.0.0.1:90$uri$is_args$args; } } # Define a server only for html files with SSI support # This is a workarround to get PageSpeed working together with SSI server { listen 90; server_name app.local www.app.local; access_log /var/log/nginx/www.app.local.access.log; error_log /var/log/nginx/www.app.local.error.log; index index.html index.htm; autoindex off; # Set the root directory to search for the file root /home/deploy/app-directory/production; location / { allow 127.0.0.1; deny all; ssi on; } } 

您可以在我发布相同问题的邮件列表中find更多详细信息。