I have a droplet in digitalocean try installs pagspeed module that returns me the following error "nginx: [emerg] unknown directive "pagespeed" in /etc/nginx/sites-enabled/default:53" I've done everything I couldn't solve.
my config.
server {
listen 80 default_server;
listen [::]:80 default_server;
#listen 443 ssl default_server;
#listen [::]:443 ssl default_server;
expires $expires;
root /var/www/html;
#fastcgi_param HTTPS on;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name xxx.xxx.xxx.xxx;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?q=$request_uri;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location ~* \.(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm)$ {
expires 1M;
access_log off;
add_header Pragma public;
add_header Cache-Control "public";
}
pagespeed on;
pagespeed FileCachePath "/var/cache/ngx_pagespeed/";
pagespeed RewriteLevel OptimizeForBandwidth;
location ~ ".pagespeed.([a-z].)?[a-z]{2}.[^.]{10}.[^.]+" {
add_header "" "";
}
location ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
}
![]() |
|
--
You received this message because you are subscribed to the Google Groups "ngx-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ngx-pagespeed-discuss/76a7199f-a6f3-47ac-8c2d-cf4182a16430%40googlegroups.com.
nginx -V
Hey, I've got ngx_pagespeed working on digitalocean.
I think your pagespeed flags need to be under the http block inside your /etc/nginx/nginx.conf. Try it there instead of sites-available/default.
If it still doesn't work, double check that the ngx_pagespeed module is actually installed with
nginx -V
Digital Ocean's guide to installing pagespeed is grossly outdated, so I've had a lot of trouble with manual install of ngx_pagespeed. It seems that automatic install is best:
thanks for the tip, well this file is listed is giving include outside http, about the installation I am using automatic, as it would be for me to add installed pagspeed I believe my nginx is not recognizing the pagspeed module.
George Chanturidze thanks, let's try to install zero.