Welcome! Log In Create A New Profile

Advanced

error_page 404 и ngx_http_index_module

Gena Makhomed
August 22, 2014 03:12PM
On 18.10.2013 16:50, Maxim Dounin wrote:

> Отдельно печалит, что в результате конфигурации с error_page 404
> @fallback - практически исчезли, хотя аналог на try_files -
> гарантированно хуже.

server {

server_name www.example.com;

root /home/www/example.com/static.www/;

location / {
error_page 404 = @php;
log_not_found off;
}

location @php {
fastcgi_param SCRIPT_FILENAME /home/www/example.com/engine/index.php;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
}
}

www.example.com - это динамика, и $uri для 99.999% запросов к этому
домену оканчиваются символом '/', например: /support/ или /about/

В каталоге static.www лежит всего несколько файлов, которые должны
быть на домене www.example.com - favicon.ico, robots.txt, sitemap.xml,
googlexxxxxxxxxxxxxxxxxx.html и yandex_xxxxxxxxxxxxxxxxxxxx.html,
а вся остальная статика для сайта www.example.com раздается
с отдельного домена example.com

Модуль ngx_http_index_module в nginx - сейчас неотключаемый.
В результате, в 100% случаев модуль ngx_http_index_module тратит
ресурсы сервера впустую, пытясь открыть заведомо не существующие
индексные файлы.

Каким способом будет более правильно отключить модуль
ngx_http_index_module ? сделать workaround
через регулярное выражение:

location / {
location ~ /$ {
return 404;
}
error_page 404 = @php;
}

Или путем патча, который добавляет возможность полного отключения
этого модуля через указание в конфиге директивы "index off;" ?

http {
index off;
...
server {
...
location / {
error_page 404 = @php;
}
}
}

- тогда сразу возвращается 404 для всех uri, оканчивающихся слэшом ('/')
без попыток что-либо искать ни диске и без необходимости применять
регулярные выражения для каждого клиентского запроса к сайту.

--
Best regards,
Gena

_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

allow/deny and return

Anton Yuzhaninov October 15, 2013 08:28AM

Re: allow/deny and return

Maxim Dounin October 15, 2013 08:46AM

Re: allow/deny and return

Ruslan Ermilov October 15, 2013 08:54AM

Re: allow/deny and return

Gena Makhomed October 15, 2013 09:00AM

Re: allow/deny and return

Maxim Dounin October 15, 2013 09:46AM

Re: allow/deny and return

Gena Makhomed October 15, 2013 12:16PM

Re: allow/deny and return

Maxim Dounin October 15, 2013 01:00PM

Re: allow/deny and return

Oleksandr V. Typlyns'kyi October 16, 2013 03:40AM

Re: allow/deny and return

Gena Makhomed October 16, 2013 10:02AM

Re: allow/deny and return

Maxim Dounin October 16, 2013 11:22AM

Re: allow/deny and return

Gena Makhomed October 16, 2013 12:58PM

Re: allow/deny and return

Maxim Dounin October 16, 2013 01:34PM

Re: allow/deny and return

Gena Makhomed October 16, 2013 02:30PM

Re: allow/deny and return

Maxim Dounin October 16, 2013 07:20PM

Re: allow/deny and return

Gena Makhomed October 17, 2013 08:56AM

Re: allow/deny and return

Maxim Dounin October 17, 2013 10:10AM

Re: allow/deny and return

Gena Makhomed October 17, 2013 02:14PM

Re: allow/deny and return

Maxim Dounin October 18, 2013 07:42AM

Re: allow/deny and return

Gena Makhomed October 18, 2013 09:20AM

Re: allow/deny and return

Maxim Dounin October 18, 2013 09:52AM

Re: allow/deny and return

Gena Makhomed October 20, 2013 09:28AM

Re: allow/deny and return

Maxim Dounin October 21, 2013 08:38AM

Re: allow/deny and return

Илья Шипицин October 21, 2013 09:02AM

Re: allow/deny and return

Maxim Dounin October 21, 2013 11:50AM

Re: allow/deny and return

Gena Makhomed October 21, 2013 01:46PM

Re: allow/deny and return

Maxim Dounin October 21, 2013 02:38PM

Re: allow/deny and return

Gena Makhomed October 21, 2013 05:46PM

Re: allow/deny and return

Maxim Dounin October 21, 2013 06:34PM

error_page 404 и ngx_http_index_module

Gena Makhomed August 22, 2014 03:12PM

Re: error_page 404 и ngx_http_index_module

Maxim Dounin August 25, 2014 08:48AM

Re: error_page 404 и ngx_http_index_modul e

Gena Makhomed August 26, 2014 03:24PM

Re: allow/deny and return

Anton Yuzhaninov October 16, 2013 05:14AM

Re: allow/deny and return

Ruslan Ermilov October 16, 2013 01:26PM

Re: allow/deny and return

Maxim Dounin October 16, 2013 02:20PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 231
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready