How to enable the Google PageSpeed module for nginx on domain in Plesk?

Follow

Comments

12 comments

  • Avatar
    Robert

    Centos ...what issue might we expect`? Or might they be already fixed?

    1
    Comment actions Permalink
  • Avatar
    George Alibegashvili

    Hello @Robert

    On Centos due to CentOS 7 kernel bug #15680 it is possible that there wouldn't be optimized static files on the website with the Pagespeed Insights extension installed in Plesk: https://support.plesk.com/hc/en-us/articles/360014944693-Pagespeed-does-not-optimize-static-files-and-throws-errors-in-Apache-logs


    As a workaround, until the issue is fixed permanently by CentOS team, it's recommended to disable the SELinux on the server.


    Excluding this bug, I did not find other OS related issues.

    1
    Comment actions Permalink
  • Avatar
    Sam Smith

    I enabled it but did not make any difference to website. Do I need to do some configuration for website performance?  If yes How can I do it. 

    0
    Comment actions Permalink
  • Avatar
    Daria Gavrilova

    Hello @Sam Smith,

    Thank you for your question.

    To troubleshoot the website performance I recommend you to check the following articles:

    0
    Comment actions Permalink
  • Avatar
    Alex Morales

    I also enabled it and did not notice any difference when checking it against google PageSpeed Insights. I also followed Daria links and it did not help. Is there any PageSpeed configuration file that needs to be modified... maybe nginx conf? it seems as though something is missing as no difference before and after was noticed on PageSpeed Insight test.

    I checked my server and installled the mod according to the directions and it is installed.

    [root@serv08 ~]# plesk sbin nginx_modules_ctl --status
    pagespeed on

    help?

    0
    Comment actions Permalink
  • Avatar
    Remigio Ruberto

    Enabled mod_pagespeed for nginx too, it's better enabled or leave disabled the "Smart static files processing"?

    0
    Comment actions Permalink
  • Avatar
    Anton Maslov

    @Alex Morales I recommend submitting a ticket to support or post the issue on a forum if you need assistance. 

    0
    Comment actions Permalink
  • Avatar
    Anton Maslov

    @Remigio Ruberto you may try both and see where the score is better for your site. "Smart static files processing" means Nginx server static files and generally it supposes to do it better.

    0
    Comment actions Permalink
  • Avatar
    Alex Morales

    @Anton Maslov thanks but I am not interested in opening a support ticket.

    --------

    I found a solution that worked for me.

    @Sam Smith, this was probably why it did not work for you either....

    The instructions above worked flawlessly for installing Google PageSpeed module for nginx in Plesk . It installs it yes, HOWEVER it is DISABLED and missing some steps to get it to work.

    The steps below will turn on the Google PageSpeed module - it worked for me, hope it works for everyone else too.


    Step one:

    create the directory /var/cache/nginx/ and change ownership to nginx.

    # chown nginx:nginx /var/cache/nginx/

     

    Step two:

    In the "Additional nginx directives" section in the Plesk admin, you will need to add the following to turn on the Google PageSpeed module on a per site basis:

    pagespeed on;
    pagespeed FileCachePath "/var/cache/nginx/";
    pagespeed RewriteLevel OptimizeForBandwidth;
    pagespeed RewriteLevel CoreFilters;

    location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
    add_header "" "";
    }

    location ~ "^/pagespeed_static/" { }
    location ~ "^/ngx_pagespeed_beacon$" { }

     

    Step three:

    Now check to see if Page Speed is running on that domain.

    # curl -I -X GET https://yourdomain.com
    HTTP/1.1 200 OK
    Server: nginx
    X-Page-Speed: 1.13.35.2-0 <-------------- this line should be here but your version may vary.

    0
    Comment actions Permalink
  • Avatar
    Ekaterina Babenko

    Hi Alex,

    It makes sense what you are saying. I have update article, thank you very much for the input. The only thing here it is better to keep domain and global nginx cache separately, so you can create separate directory for domain and specify it in the additional nginx directives. 

    0
    Comment actions Permalink
  • Avatar
    Sam Smith

    Hi Alex  @Alex Morales

    How can I create directory and  change ownership to nginx>

    Thanks

    Sam

     

    0
    Comment actions Permalink
  • Avatar
    Ekaterina Babenko

    Hello Sam,

    Just follow instructions provided in the article:
    1. Login server via SSH;
    2. Run the commands:
    # mkdir /var/cache/nginx_example_com/
    # chown nginx:nginx /var/cache/nginx_example_com/
    # chmod 700 /var/cache/nginx_example_com/

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request