Get the most out of your Centmin Mod LEMP stack
Become a Member

Nginx Cookieless domain for better performance

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by pamamolf, May 31, 2015.

  1. pamamolf

    pamamolf Well-Known Member

    3,117
    295
    83
    May 31, 2014
    Ratings:
    +531
    Local Time:
    2:59 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    Hi

    I was read on Gtmetrix and Yslow that i can enable a cookieless domain to improve performance and get a higher score there....

    Reading on the net one way is to create a subdomain and serve from there the static cookies and some other articles recommend some settings in Nginx for this without the subdomain and some of them even use something like this:

    Code:
    fastcgi_hide_header Set-Cookie;
    Any ideas what is the best way to improve this?

    Thanks
     
  2. rdan

    rdan Premium Member Premium Member

    4,363
    1,052
    113
    May 25, 2014
    Ratings:
    +1,521
    Local Time:
    8:59 AM
    Mainline
    10.2
    I'm using this kind of Implementation on my XenForo Forum and WP site.
    Here's the config I used:
    Code:
    server {
        listen 80;
        server_name x.phc.onl;
    
        include /usr/local/nginx/conf/pagespeed.conf;
        include /usr/local/nginx/conf/pagespeedhandler.conf;
        include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
        log_not_found off;
        error_log off;
        fastcgi_hide_header Set-Cookie;
        root /home/nginx/domains/staticfiles/public;
    
        location / {
        if ($request_filename ~ "\.(css|js|jpg|jpeg|gif|ico|png|bmp|pict|csv|doc|pdf|pls|ppt|tif|tiff|eps|ejs|swf|midi|mid|ttf|eot|woff|otf|svg|svgz|webp|docx|xlsx|xls|pptx|ps|class|jar|woff2|less|scss)$") {
            add_header Pragma "public";
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            add_header Access-Control-Allow-Origin *;
            access_log off;
            expires 1M;
    
            break;
            }
        return 302 http://phc.onl$request_uri;
        }
    }
    
     
    • Informative Informative x 1
  3. eva2000

    eva2000 Administrator Staff Member

    36,835
    8,062
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,418
    Local Time:
    10:59 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    I honestly don't bother with cookieless domains anymore as they have to be done from a domain not the same as your main site domain. As such there's ever the chance that folks with ad blockers only whitelisted your main domain. So any cookieless domains could be blocked. This means css and js is not being served and just breaks your site completely. Not a good first impression for new visitors to your site !
     
  4. pamamolf

    pamamolf Well-Known Member

    3,117
    295
    83
    May 31, 2014
    Ratings:
    +531
    Local Time:
    2:59 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    I am just looking for Centminmod level optimizations to get higher score on Gtmetrix/Yslow :)
     
  5. eva2000

    eva2000 Administrator Staff Member

    36,835
    8,062
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,418
    Local Time:
    10:59 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    scores are nice, but reality and real life more important :)
     
  6. pamamolf

    pamamolf Well-Known Member

    3,117
    295
    83
    May 31, 2014
    Ratings:
    +531
    Local Time:
    2:59 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    Yes sure no problem :)
     
  7. rdan

    rdan Premium Member Premium Member

    4,363
    1,052
    113
    May 25, 2014
    Ratings:
    +1,521
    Local Time:
    8:59 AM
    Mainline
    10.2
    Adblocker extension doesn't block static files/content.
    Only known adds.
     
  8. eva2000

    eva2000 Administrator Staff Member

    36,835
    8,062
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,418
    Local Time:
    10:59 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    some other browser extensions can - had it happen in the past on a few of my sites :)
     
  9. rdan

    rdan Premium Member Premium Member

    4,363
    1,052
    113
    May 25, 2014
    Ratings:
    +1,521
    Local Time:
    8:59 AM
    Mainline
    10.2
    BTW, With HTTP/2, CDN and static domain practice is obsolete :)
     
    • Like Like x 1
  10. eva2000

    eva2000 Administrator Staff Member

    36,835
    8,062
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,418
    Local Time:
    10:59 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    same with SPDY/3.1 :)
     
  11. rdan

    rdan Premium Member Premium Member

    4,363
    1,052
    113
    May 25, 2014
    Ratings:
    +1,521
    Local Time:
    8:59 AM
    Mainline
    10.2
    Can please name what adblocker extension specifically they are using?
     
  12. eva2000

    eva2000 Administrator Staff Member

    36,835
    8,062
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,418
    Local Time:
    10:59 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Can't remember this was a few years ago but the forum members reported the issue and i don't them to whitelist the cdn/cookieless domains and it fixed the problem.
     
  13. rdan

    rdan Premium Member Premium Member

    4,363
    1,052
    113
    May 25, 2014
    Ratings:
    +1,521
    Local Time:
    8:59 AM
    Mainline
    10.2
  14. eva2000

    eva2000 Administrator Staff Member

    36,835
    8,062
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,418
    Local Time:
    10:59 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  15. rdan

    rdan Premium Member Premium Member

    4,363
    1,052
    113
    May 25, 2014
    Ratings:
    +1,521
    Local Time:
    8:59 AM
    Mainline
    10.2
    Now, my forum is back to pure HTTPS.
    Waiting for HTTP/2 very soon I hope :)
    Roadmap – nginx
     
    • Like Like x 1
  16. rdan

    rdan Premium Member Premium Member

    4,363
    1,052
    113
    May 25, 2014
    Ratings:
    +1,521
    Local Time:
    8:59 AM
    Mainline
    10.2
    • Informative Informative x 1
  17. eva2000

    eva2000 Administrator Staff Member

    36,835
    8,062
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,418
    Local Time:
    10:59 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Nice... SSL is here to stay ! FYI, I now 2 source suppliers for my SSL certificates I offer to Centmin Mod Premium Members so some prices had to be revised up while others were revised down i.e. Comodo Positive Multi-domain is much cheaper :)
     
    • Like Like x 1
  18. rdan

    rdan Premium Member Premium Member

    4,363
    1,052
    113
    May 25, 2014
    Ratings:
    +1,521
    Local Time:
    8:59 AM
    Mainline
    10.2
    Right now, back to using Cloudflare FULL with HTTPS.
    Until HTTP/2 comes out :).
     
    • Like Like x 1
  19. rdan

    rdan Premium Member Premium Member

    4,363
    1,052
    113
    May 25, 2014
    Ratings:
    +1,521
    Local Time:
    8:59 AM
    Mainline
    10.2
    Planning of using HTTPS fully but looking at my GA stats for this month:
    upload_2015-6-29_3-47-20.png

    I think, still not good to use HTTTPS :(
     
  20. eva2000

    eva2000 Administrator Staff Member

    36,835
    8,062
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,418
    Local Time:
    10:59 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    add the average time on page metric to the stats and see, some times xp ones are bots too so average time of page is like <0.05 seconds or something

    but yeah some Asian countries are still predominantly WinXP and older
     
    • Like Like x 1
..