Nginx Helper

Описание

  1. Удаляет index.php из ЧПУ WordPress при использовании nginx.
  2. Добавлена поддержка очистки redis-cache при использовании страничного кеша с использованием nginx-srcache-module
  3. Добавлена поддержка nginx fastcgi_cache_purge & proxy_cache_purge директив из модуля, который предоставляет параметры, позволяющие настроить правила очистки.
  4. Добавлена ​​поддержка nginx map{..} при многосайтовой сетевой установке WordPress. С её использованием Nginx будет обслуживать загрузку файлов, даже если PHP/MySQL не будут работать. Пожалуйста, посмотрите список руководств ниже, что-бы сконфигурировать Nginx.

Руководства

Вам нужно будет следовать одному или нескольким руководствам ниже, чтобы получить желаемую функциональность:

Скриншоты

  • Настройки Nginx Helper
  • Остальные настройки

Установка

Автоматическая установка

  1. Войдите в панель администратора WordPress, перейдите в меню «Плагины» и нажмите «Добавить новый».
  2. В поле поиска введите «Nginx Helper» и нажмите «Поиск плагинов». В результатах поиска выберите Nginx Helper и нажмите «Установить сейчас». WordPress попросит вас подтвердить завершение установки.

Ручная установка

  1. Распакуйте zip-файл.
  2. Загрузите файлы в директорию /wp-content/plugins в WordPress.
  3. Активируйте плагин на странице плагинов.

Для правильной настройки ознакомьтесь с нашим списком руководстсв во вкладке Описание.

Часто задаваемые вопросы

Важно — Пожалуйста, изучите наш список https://github.com/rtcamp/nginx-helper#frequently-asked-questions актульных ЧАВО.

ЧАВО — Установка/Совместимость

В. Будет ли это работать «из коробки»?

Нет. Вам нужно внести некоторые изменения в Nginx. Ознакомьтесь с нашим списком руководств.

ЧАВО — Nginx Fastcgi Cache Purge

В. Есть ли кнопка «очистить все»? Она очищает весь сайт?

Да, это так. Он физически очищает каталог кеша. По умолчанию установлено значение /var/run/nginx-cache/.

Если ваш каталог кеша отличается, вы можете переопределить это в своем wp-config.php, добавив
define(‘RT_WP_NGINX_HELPER_CACHE_PATH’,’/var/run/nginx-cache/’);

Замените путь на свой.

В. Работает ли это для произвольных записей и таксономий?

Да. Он обрабатывает все типы записей одинаково.

В. Как узнать, подходит ли моя конфигурация Nginx для очистки fastcgi?

Ручная очистка любой страницы из кеша, следуя инструкциям в предыдущем ответе.

Начиная с версии 1.3.4, Nginx Helper добавляет комментарий в конце исходного кода HTML (используйте функцию «просмотреть исходный код» в вашем любимом браузере):
<!—Cached using Nginx-Helper on 2012-10-08 07:01:45. It took 42 queries executed in 0.280 seconds.—>. Эта строка показывает время, когда страница была в последний раз кэширована. Эта дата/время будет обновляться всякий раз, когда эта страница очищается и обновляется в кеше. Просто проверьте этот комментарий до и после ручной очистки.

Пока вы не очистите страницу (или не внесете изменения, очищающие ее из кеша), временная метка останется неизменной, даже если вы продолжаете обновлять страницу. Это означает, что страница была загружена из кеша и он работает!

Остальное показывает запросы к базе данных и время, сэкономленное при загрузке этой страницы. (Это была бы дополнительная нагрузка на сервер, если бы вы не использовали fast-cgi-cache.)

В. Мне нужно немедленно очистить кеш страницы! Как мне это сделать?

Nginx helper plugin обрабатывает сценарии, когда страница в кеше нуждается в очистке. Например, когда запись редактируется или комментарий к записи одобряется.

Чтобы немедленно очистить кеш страницы, следуйте этим инструкциям:

  • Допустим, у нас есть страница в следующем домене: http://yoursite.com/about.
  • Между доменным именем и остальной частью URL — вставьте ‘/purge/’.
  • Таким образом, в приведенном выше примере URL-адрес очистки будет http://yoursite.com/purge/about.
  • Просто откройте это в браузере, и страница будет мгновенно очищена.
  • Излишне говорить, что это не сработает, если у вас есть страница или таксономия под названием «purge».

ЧАВО — Nginx Redis Cache

В. Могу ли я переопределить имя хоста, порт и префикс redis?

Да, вы можете принудительно переопределить имя хоста, порт или префикс redis, определив константу в wp-config.php. Например:

`

define(‘RT_WP_NGINX_HELPER_REDIS_HOSTNAME’, ‘10.0.0.1’);

define(‘RT_WP_NGINX_HELPER_REDIS_PORT’, ‘6000’);

define(‘RT_WP_NGINX_HELPER_REDIS_PREFIX’, ‘page-cache:’);

ЧАВО — Nginx Map

В. Мой мультисайт уже использует WPMU_ACCEL_REDIRECT. Нужен ли мне Nginx Map?

Определенно. WPMU_ACCEL_REDIRECT уменьшает нагрузку на PHP, но по-прежнему просит WordPress, т.е. PHP/MySQL, выполнить некоторую работу со статическими файлами, например, изображения в вашем посте. Nginx map позволяет nginx обрабатывать файлы самостоятельно, минуя WordPress, что дает вам гораздо лучшую производительность без использования CDN.

В. Я использую плагин X. Будет ли он работать на Nginx?

Скорее всего да. Плагин для WordPress, если он явно не использует какой-либо код только для Apache, должен работать на Nginx. Некоторым плагинам может потребоваться дополнительная доработка.

Всё-ещё нужна помощь!

Пожалуйста, опишите Вашу проблему на нашем форуме бесплатной поддержки.

Отзывы

29.07.2022
It doesn't work at all. It provides outdated content link to setup the cache module but that is also useless. Do not waste your time installing this plugin.
25.05.2022
Clears cache when updating pages & posts as expected. Also great that it has a logging functionality, which allowed me to debug some problems.
03.05.2022
Nice plugin to manage your cache. The setup is quite simple! Just follow the instructions and you will be fine
31.08.2021 2 ответа
Had high hopes but to be able to use this plugin to best potential you need to add a repository, according to the relevant guide which seems to date back 9 years. Errors:- E: The repository 'http://ppa.launchpad.net/rtcamp/nginx/ubuntu focal Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. So what's the point? I may be missing something (such as a guide that works? Am using your recommendation: https://easyengine.io/wordpress-nginx/tutorials/single-site/fastcgi-cache-with-purging/) so sort that out, let me know, and I'll gladly update this review. Meantime, damn, that was a few hours wasted.
Посмотреть 31 отзыв

Журнал изменений

2.2.4

  • Introduces the capability to specify the NGINX_HELPER_LOG constant, allowing users to activate the logging feature. #318 — by Vishal Kakadiya
  • Existing users employing the nginx-helper plugin with logging enabled will experience no disruptions. However, if logging is disabled, users must define the NGINX_HELPER_LOG constant to re-enable the logging feature.

2.2.3

2.2.2

  • Add action rt_nginx_helper_after_purge_all to fire after the entire cache has been purged whatever caching type is used. #232 — by Julien-prrs
  • Fix issue where settings not saved because the button’s value localized (for any language). #236 — by umeshnevase
  • Fix issue where «Custom Purge URL» option displays previous value. #240, #241 — by KirillGritcenko
  • Tested with WordPress 5.4

2.2.1

2.2.0

2.1.0

  • Add wildcard cache key deletion for device type cache purge. #203 — by pradeep910
  • Add filter rt_nginx_helper_purge_url to filter the URL to be purged. #182 — by todeveni
  • Add filter rt_nginx_helper_purge_cached_file to filter the cached file name. #182 — by todeveni
  • Add filter rt_nginx_helper_remote_purge_url to filter remote URL to be purged. #182 — by todeveni
  • Add action rt_nginx_helper_after_fastcgi_purge_all to fire after the FastCGI cache has been purged. #182 — by todeveni
  • Add action rt_nginx_helper_after_redis_purge_all to fire after the Redis cache has been purged. #182 — by todeveni
  • Add action rt_nginx_helper_purged_file to fire an action after deleting file from cache. #182 — by todeveni
  • Add action rt_nginx_helper_before_remote_purge_url to fire an action before purging remote URL. #182 — by todeveni
  • Add action rt_nginx_helper_after_remote_purge_url to fire an action after remote purge request. #182 — by todeveni
  • Fix issue with post purge on new comments. #175 — by jinschoi
  • Fix Nginx Timestamp being added to invalid content type. #200 — by thrijith
  • Handle filesize exception while truncating nginx.log file. #206 — by peterjanes

2.0.3

2.0.2

  • Fix undefined error when we install the plugin for the first time and if Redis is not available. #162 — by Joel-James
  • Remove extra spacing for nginx map section. #169 — by ShashwatMittal
  • Purge Cache menu in front-end admibar now purge current page. #173 — by imranhsayed
  • Fix issue where cache is not cleared when page is swiched from publish to draft. #174 — by imranhsayed
  • Fix an issue where custom purge url option does not show newlines when using multiple urls. #184 — by mist-webit

2.0.1

  • Fix settings url for multisite: use network_admin_url to get network correct settings url. #163 — by Joel-James
  • Fix php error with arbitrary statement in empty — Prior to PHP 5.5. #165 — by PatelUtkarsh

2.0.0

  • Fix typo causing failure to purge on trashed comment. #159 — by jinschoi
  • Refactor Plugin structure and remove unused code. Initial code by chandrapatel, #153 — by jinschoi,
  • Run phpcs and fix warning. #158
  • Make compatible with EasyEngine v4.

1.9.12

  • Allow override Redis host/port/prefix by defining constant in wp-config.php #152 — by vincent-lu

1.9.11

  • Fixed issue where permalinks without trailing slash does not purging #124 — by Patrick
  • Check whether role exist or not before removing capability. #134 — by 1gor

1.9.10

  • Fixed issue where Nginx cache folders deleted on purge. #123 — by johan-chassaing
  • Fixed Redis purge all feature for installation where WordPress lives in a separate folder. #130 — by pySilver

1.9.9

1.9.8

  • Fixed homepage cache cleared when WPML plugin used #116 — by Niwreg
  • Fixed Purge Cache clears the whole Redis cache #113 — by HansVanEijsden
  • One log file for all site in WPMU.
  • Single site Redis cache purge when click on Purge Cache button in WPMU #122 — by Lars Støttrup Nielsen
  • Fixed notices and warnings.

1.9.7

  • Remove timestamp if cron or wp-cli #114 — by samedwards
  • Fixed notices and warnings.

1.9.6

  • Fixed cache purging on post publish.
  • Error fixed when redis server not installed.

1.9.5

Added custom purge URL option.

1.9.4

  • Added redis server connection timeout.
  • Added RedisException handling.

1.9.3

  • Added PhpRedis API support.
  • Added redis-lua script support to purge complete cache very fast.
  • Added composer.json support
  • Fixed cache purging link in admin bar.
  • Updated the initial settings to include the ‘purge_method’ #99 — by
    gagan0123

1.9.2

Fix purging for Redis cache and FastCGI cache

1.9.1

Fix purging for custom post types

1.9

Added Redis cache purge support.

1.8.13

Fixed PHP notice for an undefined index when «Enable Logging» is not set.

1.8.12

Updated readme and changelog

1.8.11

Fix url escaping #82 — by
javisperez

1.8.10

  • Security bug fix

1.8.9

  • Default setting fix and wp-cli example correction — by bcole808

1.8.8

  • Added option to purge cache without nginx purge module — by bcole808

1.8.7

  • Added action rt_nginx_helper_purge_all to purge cache from other plugins — by gungeekatx

1.8.6

  • Removed wercker.yml from plugin zip/svn.
  • Updated readme

1.8.5

1.8.4

  • Fix undefined index issue and correct «purge_archive_on_del» key

1.8.3

  • Tested with WordPress 4.0
  • Fix issue #69

1.8.1

  • Tested with wordpress 3.9.1
  • Fix confilct with Mailchimp’s Social plugin

1.8

  • New admin UI
  • Fix missing wp_sanitize_redirect function call

1.7.6

  • Update Backend UI
  • Added Language Support

1.7.5

  • Fixed option name mismatch issue to purge homepage on delete.

1.7.4

  • Disable purge and stamp by default.

1.7.3

  • Suppressed unlink related error-messages which can be safely ignored.
  • Fixed a bug in purge-all option.

1.7.2

  • pjv fixed bug in logging file.

1.7.1

  • Fixes bug in true purge and admin screen.

1.7

  • True full cache purge added.
  • Map file location changed to uploads’ directory to fix http://rtcamp.com/support/topic/plugin-update-removes-map-file/
  • Log file location also changed to uploads’ directory.

1.6.13

  • pjv changed the way home URL is accessed. Instead of site option, the plugin now uses home_URL() function.

1.6.12

  • telofy added purging of atom and RDF feeds.

1.6.11

  • Removed comments from Admin screens since, it was interfering with media uploads in 3.5 up.

1.6.10

  • Cleaned up code.
  • Added credits for code.
  • Improved attachment purging.

1.6.9

  • Added Faux to Purge all buttons, to avoid misleading users.

1.6.8

1.6.7

  • jk3us added better content-type detection for cache verification comments

1.6.6

1.6.5

  • Fixed typo that interfered with archive purge settings. Thanks to Daan Kortenbach for pointing this out.

1.6.4

  • Improved code for map generation to better conventions since the nesting confused some servers.
  • Added map update process to admin_init for frequent refreshes.

1.6.3

  • Fixed duplicate entries.

1.6.2

  • Another bug fix in the revised code for improved multisite and multidomain mapping.

1.6.1

  • Fixed bug in the revised code for improved multisite and multidomain mapping.

1.6

  • Revised code for improved multisite and multidomain mapping.

1.5

  • Timestamp now only gets added to content-type text/html
  • Added option to toggle timestamp creation

1.4

  • Fixed bug related to nomenclature of comment status that caused purge to fail.

1.3.9

  • Removed extraneous headers.

1.3.8

  • Fixed bug in single post/page/post-type purging code. Thanks to Greg for pointing this out here: http://rtcamp.com/support/topic/updating-post-nginx-helper-purge-cache-post/.

1.3.7

  • Changed the action hook, back to ‘shutdown’ from ‘wp_footer’ to add verification comments.
  • Added a check to prevent adding comments to ajax requests,

1.3.6

  • Changed the action hook, from ‘shutdown’ to ‘wp_footer’ to add verification comments. This was interfering with other plugins.

1.3.5

  • Improved Readme.
  • Improved cache verification comments.

1.3.4

  • Fixed duplicate entries generated for maps (Harmless, but doesn’t look good!)
  • Added timestamp html comments for cache verification, as described here: http://rtcamp.com/wordpress-nginx/tutorials/checklist/

1.3.3

  • Fixed map generation for multi domain installs using domain mapping plugin, where blog ids were not displayed.

1.3.2

  • Fixed map generation for multi domain installs with domain mapping plugin.

1.3.1

  • Minor fixes for directory structure and file names.

1.3

  • Improved Readme.

1.2

  • Fixed map generation error.
  • Fixed purging logic.
  • Fixed UI where purge settings were lost on disabling and re-enabling purge.
  • Minor Ui rearrangement.

1.1

  • Improved readme.txt. Added Screenshots.

1.0

  • First release