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

    2,825
    253
    83
    May 31, 2014
    Ratings:
    +449
    Local Time:
    3:52 PM
    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. RoldanLT

    RoldanLT Well-Known Member

    3,979
    966
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,331
    Local Time:
    9:52 PM
    1.11
    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

    31,001
    6,919
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,424
    Local Time:
    11:52 PM
    Nginx 1.13.x
    MariaDB 5.5
    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

    2,825
    253
    83
    May 31, 2014
    Ratings:
    +449
    Local Time:
    3:52 PM
    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

    31,001
    6,919
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,424
    Local Time:
    11:52 PM
    Nginx 1.13.x
    MariaDB 5.5
    scores are nice, but reality and real life more important :)
     
  6. pamamolf

    pamamolf Well-Known Member

    2,825
    253
    83
    May 31, 2014
    Ratings:
    +449
    Local Time:
    3:52 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    Yes sure no problem :)
     
  7. RoldanLT

    RoldanLT Well-Known Member

    3,979
    966
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,331
    Local Time:
    9:52 PM
    1.11
    10.2
    Adblocker extension doesn't block static files/content.
    Only known adds.
     
  8. eva2000

    eva2000 Administrator Staff Member

    31,001
    6,919
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,424
    Local Time:
    11:52 PM
    Nginx 1.13.x
    MariaDB 5.5
    some other browser extensions can - had it happen in the past on a few of my sites :)
     
  9. RoldanLT

    RoldanLT Well-Known Member

    3,979
    966
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,331
    Local Time:
    9:52 PM
    1.11
    10.2
    BTW, With HTTP/2, CDN and static domain practice is obsolete :)
     
    • Like Like x 1
  10. eva2000

    eva2000 Administrator Staff Member

    31,001
    6,919
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,424
    Local Time:
    11:52 PM
    Nginx 1.13.x
    MariaDB 5.5
    same with SPDY/3.1 :)
     
  11. RoldanLT

    RoldanLT Well-Known Member

    3,979
    966
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,331
    Local Time:
    9:52 PM
    1.11
    10.2
    Can please name what adblocker extension specifically they are using?
     
  12. eva2000

    eva2000 Administrator Staff Member

    31,001
    6,919
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,424
    Local Time:
    11:52 PM
    Nginx 1.13.x
    MariaDB 5.5
    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. RoldanLT

    RoldanLT Well-Known Member

    3,979
    966
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,331
    Local Time:
    9:52 PM
    1.11
    10.2
  14. eva2000

    eva2000 Administrator Staff Member

    31,001
    6,919
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,424
    Local Time:
    11:52 PM
    Nginx 1.13.x
    MariaDB 5.5
  15. RoldanLT

    RoldanLT Well-Known Member

    3,979
    966
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,331
    Local Time:
    9:52 PM
    1.11
    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. RoldanLT

    RoldanLT Well-Known Member

    3,979
    966
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,331
    Local Time:
    9:52 PM
    1.11
    10.2
    • Informative Informative x 1
  17. eva2000

    eva2000 Administrator Staff Member

    31,001
    6,919
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,424
    Local Time:
    11:52 PM
    Nginx 1.13.x
    MariaDB 5.5
    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. RoldanLT

    RoldanLT Well-Known Member

    3,979
    966
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,331
    Local Time:
    9:52 PM
    1.11
    10.2
    Right now, back to using Cloudflare FULL with HTTPS.
    Until HTTP/2 comes out :).
     
    • Like Like x 1
  19. RoldanLT

    RoldanLT Well-Known Member

    3,979
    966
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,331
    Local Time:
    9:52 PM
    1.11
    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

    31,001
    6,919
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,424
    Local Time:
    11:52 PM
    Nginx 1.13.x
    MariaDB 5.5
    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