Nginx tries to open the html file and through error 404. I expected the redirection to the php script
dertin
nginx-forum at forum.nginx.org
Fri Nov 30 18:39:46 UTC 2018
Hi,
Nginx tries to open the html file and through error 404.
I expected the redirection to the php script.
server {
listen 443 ssl http2 fastopen=500 reuseport;
listen [::]:443 ssl http2 fastopen=500 reuseport ipv6only=on;
server_name www.testing.com.uy;
resolver 1.1.1.1 1.0.0.1 valid=300s;
charset utf-8;
root /var/www/webdisk/testing.com.uy/htdocs;
autoindex off;
index load.php index.php index.html;
pagespeed Disallow "*";
pagespeed Allow "https://www.testing.com.uy/*";
pagespeed Disallow "*/blog/*";
pagespeed Disallow "*/ws/*";
pagespeed Disallow "*/not-exist-file/*";
# Script PHP - WORK
location ~ \.php$ {
include /etc/nginx/fastcgi.conf;
fastcgi_pass unix:/run/php/php7-fpm.sock;
}
# Wordpress - WORK
location ~ /blog/ {
index index.php;
try_files $uri $uri/ /blog/index.php?$args;
break;
}
# NOT WORK With \.html
# Nginx tries to open the html file and through error 404.
# I expected the redirection to the php script.
location ~ /not-exist-file/([a-zA-Z0-9-]*)\.html$ {
rewrite /not-exist-file/([a-zA-Z0-9-]*)\.html$
/not-exist-file/post.php?name=$1 last;
break;
}
location ~* /(.+)$ {
# /test.html -> /public/prov/test.html - WORK
if (-f $document_root/public/prov/$1.html) {
rewrite (.+)$ /public/prov/$1.html last;
break;
}
# Framework PHP - WORK
if (!-e $request_filename) {
rewrite (.+)$ /load.php?request=$1 last;
break;
}
}
}
Error:
[debug] 50772#0: *64 Passing on content handling for non-pagespeed resource
'https://www.testing.com.uy/not-exist-file/test.html'
[error] 50772#0: *64 open()
"/var/www/webdisk/testing.com.uy/htdocs/not-exist-file/test.html" failed (2:
No such file or directory), client: X.X.X.X, server: www.testing.com.uy,
request: "GET /not-exist-file/test.html HTTP/2.0", ...
Regards.
Guillermo.
Version:
uname -a
Linux host 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u6 (2018-10-08) x86_64
GNU/Linux
nginx -V
nginx version: nginx/1.15.6 built by gcc 6.3.0 20170516 (Debian
6.3.0-18+deb9u1) built with OpenSSL 1.1.1 11 Sep 2018 TLS SNI support
enabled configure arguments: --prefix=/usr/share/nginx
--sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf
--pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log --user=www-data --group=www-data
--without-mail_pop3_module --without-mail_imap_module
--without-mail_smtp_module --without-http_uwsgi_module
--without-http_scgi_module --without-http_memcached_module
--with-http_ssl_module --with-http_stub_status_module
--with-http_gzip_static_module --with-http_v2_module --with-file-aio
--with-http_realip_module --with-http_sub_module
--with-ld-opt='-L/usr/local/lib -Wl,-rpath,/usr/local/lib -ljemalloc'
--with-cc-opt='-m64 -march=native -DTCP_FASTOPEN=23 -g -O3
-fstack-protector-strong -fuse-ld=gold --param=ssp-buffer-size=4 -Wformat
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -gsplit-dwarf'
--add-module=/var/tmp/nginx_build/nginx_src/./incubator-pagespeed-ngx-1.13.35.2-stable
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,282219,282219#msg-282219
More information about the nginx
mailing list