Search Results for 'nginx'

    No search results were found in Documentation!

Results from the Forum
revolution180
tagDiv Member

also
i noticed in documentation this statement:
make sure that you have APC installed or another ‘op cache’ for php. This will reduce your server response time.We have receive some reports that the accelerator has some problems in some specific configurations with our theme and Nginx.

does it mean we should not use Nginx?

– also, i meant that the SWIPE MENU ON MOBILES or the standard menu on responsive (mobile) is not working.
thanks

Manuel Fink
tagDiv Member

I finally got someone optimizing nginx settings for me.

However can anyone confirm @Stevens settings? My first try seems that it is not any better than using w3cache

Checking link http://staging.dailycat.de/hund-rettet-katzenbabys-670/ checked with http://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fstaging.dailycat.de%2Fhund-rettet-katzenbabys-670%2F&tab=mobile

Old server vhosting (w3cache no nginx) (http://www.dailycat.de)
GPagespee 54 / 66 GtMatrix 83 / 68

New Server (same config as old) GPageSpeed 55 / 68 GtMatrix 86 / 70
New Server (@Stevens Konfiguration) GPageSpeed 48 / 71 GtMatrix 83 / 66

Mobile is the most important metric for me, since 65% of the visitors are mobile visitors!

Manuel Fink
tagDiv Member

In the “how to make the site fast” page by marius you mention

We have receive some reports that the accelerator has some problems in some specific configurations with our theme and Nginx.

Has anyone experience with nginx and can share his settings?

simchris
tagDiv Member

@manual
best bet for my stuff, is go “backwards” from here as the stuff for htaccess file still good, for Apache/Linux. I’m only running nginx for some stuff on our server, we use Apache for compatibility with 20 years of content and some stuff not practical to reinvent at this time.

mod_pagespeed … I am running kind of a moderate number of things with defaults on server wide, then htaccess for local per site/folder controls/over-rides or “off.” With nginx I think you have to use a config file.

Anyway…. here’s my htaccess minus the 301 stuff:

<IfModule pagespeed_module>
ModPagespeed on
ModPagespeedEnableFilters collapse_whitespace
ModPagespeedEnableFilters move_css_to_head
ModPagespeedEnableFilters combine_css
ModPagespeedEnableFilters remove_comments
ModPagespeedEnableFilters rewrite_images
ModPagespeedEnableFilters insert_dns_prefetch
</IfModule>

# start WordPress
(removed; might be diff for other setups :-)
# END WordPress

AddType text/javascript .js

# BEGIN Expire headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 2500000 seconds"
ExpiresByType image/jpeg "access plus 2500000 seconds"
ExpiresByType image/png "access plus 2500000 seconds"
ExpiresByType image/gif "access plus 2500000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2500000 seconds"
ExpiresByType text/css "access plus 700000 seconds"
ExpiresByType text/javascript "access plus 700000 seconds"
ExpiresByType application/javascript "access plus 700000 seconds"
ExpiresByType application/x-javascript "access plus 700000 seconds"
ExpiresByType text/html "access plus 600 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
</IfModule>
# END Expire headers

# BEGIN Cache-Control Headers
<IfModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "private"
</filesMatch>
<filesMatch "\.(x?html?|php)$">
Header set Cache-Control "private, must-revalidate"
</filesMatch>
</IfModule>
# END Cache-Control Headers

<IfModule mod_headers.c>
    Header unset ETag
</IfModule>
<IfModule mod_alias.c>
RedirectMatch 403 /xmlrpc.php
</IfModule>

Here’s my robots.txt file (again, your needs may vary)

User-agent: *
 Disallow: /cgi-bin
 Disallow: /cgi-bin/
 Disallow: /wp-admin
 Disallow: /wp-admin/
 Disallow: /wp-includes
 Disallow: /wp-includes/
 Disallow: /wp-content/plugins
 Disallow: /wp-content/cache
 Disallow: /wp-content/themes
 Disallow: /wp-content/upgrade
 Disallow: /wp-content/backup-*
 Disallow: /aff/
 Disallow: /search/*/*
 Disallow: /trackback
 Disallow: */trackback
 Disallow: /trackback/

We’re currently not running things off our Amazon CDN for the WP sites, in favor of using the horsepower of the dedicated server with high-speed switch, APC, mod_pagespeed, etc. Not finding it super beneficial to load those 1kb sprites off the CDN, frankly. (Brand new web server Dec. 2013). And for us tweaking is simpler when it’s all using one system, and letting mod_pagespeed fix some stuff.

I was manually minifying the style.css file and couple other things. Have not done that with latest version (just updated last weekend). Simple to do … some of my posts on here reference the websites like css minifier where you can copy/paste your code, make new file and over-write the theme css file to solve that issue (takes 5 minutes).

I had too many issues with the caching plugins so not using right now.

Take Google’s PageSpeed Insights with major grain of salt.

On one of my project sites (not running WP), we have the CSS loading from external file, minified, got pagespeed score of 87 and warning about only 47% of page loading above the fold (menu wasn’t showing up), and this could be seen missing from screen capture. So, we put all the code inline, speed went to 95 desktop, 85 mobile, but warning about above the fold now says only 1% was able to be loaded, but snapshot of screen shows everything above fold loaded properly.

Similarly on our WP install running Newspaper, here’s one of their wonderful “suggestions” ….

Reduce server response time
In our test, your server responded in 0.36 seconds. There are many factors that can slow down your server response time. Please read our recommendations to learn how you can monitor and measure where your server is spending the most time.

So, apparently 0.36 seconds is considered slow?

🙂

Manuel Fink
tagDiv Member

It’s pretty hard to follow this thread from the beginning since a lot of it is for earlier versions. @Simmons could you or anyone share the best practises/combination of settings for
– theme / plugins
– .htacces
– mod_pagespeed
nginx
for the latest version of the theme?

I really would appreciate this information. Thx.

Manuel Fink
Participant
#0

Hey Everyone,

I use random posts underneath each article in the similar articles area and in the sidebar widget.

It is very important for me to not always show the same recommendations. This is important, thus all articles get shown and trafficed. This becomes somehow tricky than caching comes in.

Thus I wanted to ask you guys for your expertise and hints! Any best practices out there?
How do you cache continuous loading?

My solution for now: I’m using nginx and reduced the cache time of posts to 1min.

Thx, I really appreciate your help!
Best regards, Manu

simchris
tagDiv Member

1) remove all external loading elements like social media, advertising, recaptcha, and anything which loads css or js as part of its content; anything not part of the theme

2) use the minification tools I’ve suggested in the pagespeed sticky topic – such as online minification tools, or use the GTMetrix optimized versions provided during the site scan

Basically you need to take the CSS and JS files which PageSpeed is saying need to be minified, and then copy those from your theme directory, minify them, then save the minified version over the original.

One tool to minify the CSS is here:
http://cssminifier.com/

or
http://gpbmike.github.io/refresh-sf/

After you have your minified versions, say of style.css you would need to FTP the minified version(s) to your web site into the wp-content/themes/newspaper folder in the appropriate place.

NOTE: you need to clear all caching, turn OFF caching, and then upload the optimized versions, so that the new versions get cached not the old ones.

3) see 2

If you have a page speed of “82”
then be sure to
1) have faster web hosting account
2) ensure that gzip/deflate are working on your server (mandatory!)
3) enable expires headers (mandatory!)
4) optimize your images

All of this is well covered in the PageSpeed sticky topic in the forum. Optimization of your server, content, and htaccess or nginx config files are not part of the theme.

There is no way for you to optimize external content such as AdSense, AddThis, Recaptcha, Disqus, etc. which are not being served on your actual site.

For max speed you will need to use web safe fonts (not Google fonts), and then comment out the fonts in your functions.php file.

  • This reply was modified 12 years by simchris.
simchris
tagDiv Member

@THOR
for testing actual speed you likely need to turn off some of the external elements like social media plugin, advertising, etc.

Try testing with GTMetrix instead as it will SHOW you where the problems are and how to fix.

Also, rather than set expiration headers with plugin, you can do magic with the .htacess file settings I note in this forum (not for use with nginx). Much more efficient.

  • This reply was modified 12 years by simchris.
simchris
tagDiv Member

@fabriciosahdo
I don’t work here, just trying to be helpful.

No theme can help you optimize your hosting, or web server setup. No theme can optimize the content you’re uploading automatically. No theme can customize the settings needed for your htaccess or nginx config file. These are things YOU need to do in optimizing your or any WordPress-based website.

Just like the demo shows an example of how your site might look, YOU still have to configure it to your needs.

A theme is only a set of content styles running on top of your WordPress install, which is running on top of your domain account, which is running on top of the web server setup.


You should contact the theme developer for any refund issues.

You may want to hire a WordPress developer if many of the elements of managing a WordPress site are new to you. You should definitely explore how PageSpeed works for a better understanding of what is involved, as you will need to optimize your system with *any* theme you choose to use.

  • This reply was modified 12 years by simchris.
danielpetre
tagDiv Member

Thanks Radu, i’m not gonna fiddle anymore with this, im kindof tired,
i just solved in my nginx.conf, here is the line of the server block for :80 that redirects all requests to /wp-login to the ssl part of the site:

location ~ \.php$ {
location ~* /wp-login { return 301 https://$host$request_uri; }
STUFF
}

it was:
location ~ /wp-(admin|login) { return 301 https://$host$request_uri; }
and was erroring for Newspaper theme, saw it in firefox web console..

danielpetre
tagDiv Member

I think i got it, i had a redirect in nginx for ssl under wp-admin, commented out and it works now but.. why the hack does it call wp-admin/admin-ajax.php for the live search function? aint stuff in wp-admin/* supposed to be only for logged in users??

simchris
tagDiv Member

@gmaarie
Hi… we use Apache for compatibility with widest range of applications, and because we have dedicated server so we can run Apache for some stuff, Nginx for others, multiple versions of php, etc.

I’ve only used Apache the past 20 years on the web for our servers, and so I am likely zero help whatsoever on other platforms. Usually you can simply Google something like “setting expires headers for wordpress on litespeed” or something like that, and see what pops up.

Nice thing is with the “alternative” platforms, a lot of people are using them with WordPress and are breaking the trail on that stuff.

🙂

Radu
tagDiv Staff

Hi,


@uzairfreak
you are getting a very good speed.
from here: http://screencast.com/t/sGX4rgLlfkA

1. the files are served to slow by your server – use a cdn or … if you are familiar with nginx use that instead of apache
2. try to manually compress the css using an online css compressor maybe that will make get a better score without updating / configuring the server

The speed booster plugin is working on your site (make sure that you empty the cache when you test with or without it).

sorry for the delay… we try to answer all of the questions as fast as we can.


@Vinay
Prajapati – please give me your site url!


@mixvice
– our speed booster plugin is moving all the stuff at the bottom


@Steven
– google’s pagespeed tools gives a better score with css at the bottom but you lose html5 validation 😐 .

simchris
tagDiv Member

Yes, as noted in my original posts, we’re running Apache.

Nginx requires different syntax. Perhaps somebody else can help with that.

SO this means you need to work with your hosting provider to ensure proper expires headers, caching settings, etc., or ask them what file to edit for your particular hosting setup.

eg.

Nginx virtual host configuration file:

 location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
 expires 1y;
 log_not_found off;
 }
ToniLaird
tagDiv Member

Well Christopher after all that any editing of the .htaccess would be pointless. This was a reply from my hosting provider

because our system is built on NGINX and not Apache, we do not use the .htaccess file for anything. Making changes to it will not affect the site in any way

simchris
tagDiv Member

Wow. 7 seconds is a lifetime ! It might be due to running a proxy? A lot of folks running nginx (we’re running Apache, and then nginx for SOME things not all) seem to run through a proxy, and that might cause the issue. Perhaps check amount of memory allocated to PHP ? I think mine is set to 512MB, with 256M being typically the best lower limit for WP these days. I think you already checked that.

If you can see a noticeable slowdown running that just from the server, two things you might try is a traceroute between the API IP and your DNS, and/or check with your hosting provider to explain the issue. It might be something they have run across before.

Or it could be some weirdo voodoo thing like why my stupid Font Awesome 4 CSS don’t load consistently off Amazon’s CDN, or from the free CDN that also hosts bootstrap. Gave up on that one 🙂

r1kay
tagDiv Member

Hey Christopher! When I run the script (with api key) locall with wamp server, the response time is almost zero. When executing the code on my server (by putting a clean php code in the root and execute it by requesting the file), there’s a delay. Almost 7 seconds delay. Now, i know you are also running a plesk server, do you know if it could have to do something with my server settings? I already tested it by processing PHP by Apache instead of nginx but that doesn’t make a difference. I’m on PHP version 5.4.23, but maybe i’m missing some php extensions?

  • This reply was modified 12 years by r1kay.
r1kay
tagDiv Member

Well i use the sharedcount api to count the total shares for me. It´s considered one of the fastest api to do this. Maybe i have configured the function wrong, i´ve tested it without caching and this peace of code make the website render at least 3 seconds later. Maybe you can have a look:

function getTotalShares($atts) {
extract(shortcode_atts(array(
    'cache' => '600',
    'url' => 0,
    'f' => 0,
    'bgcolor' => '#7bc6f1',
    'bordercolor' => '#000',
    'borderwidth' => '0',
    'bordertype' => 'solid',
    'fontcolor' => '#fff',
    'fontsize' => '18',
    'fontweight' => 'normal',
    'padding' => '1',
	'fontfamily' => 'Oswald'
  ), $atts));

 $shareHash = "$cache.$url.$f.$bgcolor.$bordercolor.$borderwidth.$bordertype.$fontcolor.$fontsize.$fontweight.$padding.$fontfamily";
 $totalShareRecord = 'totalshares_' . $shareHash;
 $cachedposts = get_transient($totalShareRecord);
 if ($cachedposts !== false) {
 return $cachedposts;

 } else {

   if (!$url) $url = get_permalink($post->ID);

   $json = wp_remote_retrieve_body( wp_remote_get("http://api.sharedcount.com/?url=" . rawurlencode($url) . "&apikey=0928d3131a18a15945e4c74fa1a68cef3c6f2ad8"));
    $counts = json_decode($json, true);
    $return = $counts['Twitter'] + $counts['Facebook']['total_count'] + $counts['GooglePlusOne'];
    if ($f) $return = '<div id="totalshares"><img src="http://mhmag.nl/content/uploads/2014/04/viral-icon-retina-42-x-42.png" width="21" height="21" /><div id="sharecounter">' . $return . '</div><div id="gedeeld">x gedeeld</div></div>';
    set_transient($totalShareRecord, $return, $cache);
    return $return;
 }
}
add_shortcode('totalshares','getTotalShares');

Also, the total share counts are shown right below the post title, so maybe that prevents the page from rendering? I’ve added the shortcode in loop-sigle.php right below the page title and above the category and date meta.

Without this function the website will load very quickley, even without cache, due to the nginx set up.

  • This reply was modified 12 years by r1kay.
r1kay
Participant
#0

Hi,

Since a couple of days in noticed that my website is very slow when not serving cached pages of when caching is disabled. I’ve narrowed the problem down to a plugin and a custom function in functions.php that make (js) calls to social media api’s to count the amount of social media shares for each post on the website. These two “plugins” result in a very slow website and a slow cached page generation. I’m running on a VPS (with enough resources, it’s little overpowered) with Plesk 11 which uses Nginx as a reverse proxy. Nginx handles all PHP, static files and is configured to work with WP Super Cache to serve compressed cached pages.

The problem I encounter with these two “plugins” is that the generation of dynamic cached pages take more than 20 seconds in some cases, which normally only took less than a second, a couple of seconds at worst. Also, the time to first byte can take up to 6 seconds, instead of the less than 1 second which is normal.

Without caching is disabled, the page will still load very slowly, as if the rendering only starts when those javascripts are handled. I know this isn’t exactly theme related, but i’ve read somewhere in another post that it’s possible to move the plugins javascripts and css to the footer by using the wp-booster plugin.

I now know what causes the problem, but i don’t exactly how. I’m desperate for a solution and hope someone can help me!

simchris
tagDiv Member

@orcn

gzip/deflate is managed at the web server level – it needs to be running for your hosting account. This allows the web server to automatically compress everything sent by the web server from your site to the web browser. This alone is good for 20+ points. This is the #1 thing which should be addressed. Ideally your web host should have this on for your account. If they won’t enable it, move to another host who will!

If you look at my posts there is an example of the .htaccess settings that I used for
the “expiration headers”

For images:
1) you need to use a compression plugin, like smush.it or similar (see comments from others in the thread); this will optimize all the thumbs created by WP and the theme
2) upload well compressed images (e.g., 25-40kb max, not 150kb or 700kb — unless you’re doing some kind of photo/portfolio site where quality is first concern)
3) consider changing the compression level by default in WP, which is done in the functions.php file at bottom using the code I’ve suggested in my posts — setting it to something like “60” vs the default “90” (I think), will cut the size of the thumbs by a huge amount.

For my particular brand of magic, try putting this at the end of your .htaccess file:

AddType text/javascript .js

# BEGIN Expire headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 2500000 seconds"
ExpiresByType image/jpeg "access plus 2500000 seconds"
ExpiresByType image/png "access plus 2500000 seconds"
ExpiresByType image/gif "access plus 2500000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2500000 seconds"
ExpiresByType text/css "access plus 700000 seconds"
ExpiresByType text/javascript "access plus 700000 seconds"
ExpiresByType application/javascript "access plus 700000 seconds"
ExpiresByType application/x-javascript "access plus 700000 seconds"
ExpiresByType text/html "access plus 600 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
</IfModule>

<IfModule mod_headers.c>
    Header unset ETag
</IfModule>
<IfModule mod_alias.c>
RedirectMatch 403 /xmlrpc.php
</IfModule>

NOTE: if you use pingback or post by email, don’t put in that last 3 lines, as I do this to keep spammers from posting comments via pingback even when comments are off (!).

The above assumes your web host is running Apache, and not IIS, or nginx or other. If so, you might have to tweak those for your particular host. Apache is the most common, however.

Also: make backup, via FTP, or your hosting panel fileManager of your .htaccess file first; then if your site doesn’t load with the new elements, put back your original version.

Hope that helped.

  • This reply was modified 12 years by simchris.
jbenitez
tagDiv Member

Well got it sorted out, and it was a metter of PHP handling by Media Temple:

– I had to disable Fast CGI and process evertyhing in CGI
– I disabled NGINX processing as well
– Reseted the permalinks and downgraded to Yoast SEO 1.4, and all works fine

What a wild ride and weird issues, thank you all for your help!

r1kay
tagDiv Member

Christopher, we recently had a discussion in my thread about Plesk, server caching, and nginx and you look like a guy who seriously knows what he is talking about 🙂 So i’m going to ask you if you could help me out in this thread about a custom function to hide ads on certain pages. I’m sure you know how to find a solution for my problem 🙂 I would really appreciate your help!

Sorry for going completely offtopic!

  • This reply was modified 12 years by r1kay.
simchris
tagDiv Member

Some our sites generate 2+ million page views per month and have been online 14 years with 230,000 inbound sites for pagerank. We have been managing our own servers since 1996, and ran a hosting company from 1996-2005. We did Oprah Winfrey’s ecom solution for her “Begin with Love” videos a decade ago. Pretty savvy. We are also PCI-DSS certified, and have weathered serious server attacks so have complex security stuff in place. ‘=)

We do use nginx along with Apache 2.2 – for instance phpmyadmin runs on nginx. 32GB of RAM, dedicated 1GB switch at SoftLayer in Texas. Power to burn. Replaced our 2008 server with 12GB RAM and 8 cores. Wild times compared to the days of, say Cobalt RaQ4 (google it).

Still playing with mod_pagespeed stuff as they have lots of cool things like “inline_google_font_css” (Inlines small CSS files used by fonts.googleapis.com into the HTML document.) which I’ve not yet been able to get working. Defer javasceript is another one built-in which is cool.

Stable version from November, edge version from January, and you can’t mix ’em.

Anyway… I’m trying to find the balance of the traditional hacks
1) mods to the wp-config.php
2) mods to functions.php
3) mods to htaccess (Apache)
4) manual optimization of css file if a rewrite system breaks it
5) upload best practice optimized images to begin with; generate smaller thumbs to start with using built-in compression of WordPress vs plugin for initial files; remove duplicate sizes in media setup to match theme size

6) use mod_pagespeed to manage cache (with memcache, eAccelerator, APC, etc.); rewrite on the fly to cache copies with comments removed, delete white space (instant minification!); combine CSS, combine JS, etc.

6) when all that fails to keep a “92” dump the CSS/JS onto the CDN, keep images local.

This is my mission for January. Once done, I’ll have a better sense of what actually works and what is truly a fool’s errand.

BTW: my friends at GTMetrix have a nice plugin for WordPress for testing/tracking pagespeed adventures (recommended!).

MOre later in the pagespeed “forum” here 🙂

I will probably end up doing some kind of ebook for this whole shenanigans.

Chris

  • This reply was modified 12 years by simchris.
r1kay
tagDiv Member

Thanks Christopher. I took a look at mod_pagespeed, but it doesnt look like it could do anything for me at this point. I’m already on a VPS that runs Plesk 11 with nginx as a reverse proxy. I’m letting nginx handle all php scripts and serve static and dynamic content. Gzip compression is enabled and i enabled browser caching through nginx with the expiration set to two weeks. I’m running WP Super Cache as well to create pre cached pages and i use EWWWW Image Optimizer to optimize all images. I also optimazed all theme and plugin images with that plugin. You might want to look it up, imo it really is a better plugin than smush.it and so. I use the simple minify plugin to minify all javascripts and i my pagespeed currently toggles between 85 en 92 for desktop, depending on my server response time and between 70 and 80 for mobile. The only red warning i still get is to defer javascript and css (moste google fonts, and 3 theme css files: bootstrap, style.css and child theme style.css) to below the fold, but i have no experience on how to do that. Im really pleased with the pagespeed right now, but more tips (besides using a CDN) are welcome!

Thanks for you responce anyway 🙂

Radu
tagDiv Staff

Hello,

for javascript we already have the minified versions in js/min . For the rest of the site I would not recomment that you minify the html. It provides minimum gains. Also our users are using the mod_pagespeed plugin for apache (i think there is a version for nginx too).

Viewing 25 results - 426 through 450 (of 452 total)