Nginx returns 404 for a wordpress multisite installation

Siddharth Jain siddjain at
Tue Sep 29 16:08:50 UTC 2020

 I have a wordpress 5.4 multisite install running on php-fpm and nginx. I have this config:
which I have taken directly from

I am able to access the base URL fine but any requests for the subsites return 404 from nginx. The request is not even forwarded to wordpress (php-fpm).

Given a request for my child site which looks like /foobar, When I look at the config it seems it will match following location block

location / {
        try_files $uri $uri/ /index.php?$args ;

>From there it will attempt to do internal redirect to /index.php. So the foobar is lost and I would expect the base site to load - which is also wrong btw. I tested this over here:

But a 404 is observed instead. Can anybody help please?

Is there any tool that can be used to test what nginx is doing when it receives a URL? I would like to get a dump of all the variables such as request_filename, uri etc. and the location block its selecting etc.

I am running everything inside docker and using nginx:1.17 image.

# nginx -V
nginx version: nginx/1.17.10
built by gcc 8.3.0 (Debian 8.3.0-6)
built with OpenSSL 1.1.1d  10 Sep 2019
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/ --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-1.17.10/debian/debuild-base/nginx-1.17.10=. -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 257107 bytes
Desc: image.png
URL: <>

More information about the nginx mailing list