<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
 <span style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">I have a wordpress 5.4 multisite install running on php-fpm and nginx. I have this config:</span></div>
<div dir="ltr">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<a href="https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/#rewrite-rules-for-multisite-using-subdirectories" id="LPlnk922330">https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/#rewrite-rules-for-multisite-using-subdirectories</a><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
which I have taken directly from nginx.com</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
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). </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
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</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<pre style="overflow:auto; font-family:"Courier 10 Pitch",Courier,monospace; font-size:0.9em; padding:7px 30px; margin:15px 0px; line-height:1.3em; background:none 0px 0px repeat scroll rgb(238,238,238)!important; display:block; color:rgb(51,51,51); word-break:break-all; border:1px solid rgb(204,204,204); border-radius:4px; font-weight:200; outline:0px; max-width:100%; tab-size:4; white-space:pre-wrap"><span class="x_x_kn" style="font-size:14.4px; font-weight:bold; margin:0px; outline:0px; color:rgb(0,112,32)">location</span> <span class="x_x_s" style="font-size:14.4px; margin:0px; outline:0px; color:rgb(64,112,160)">/</span> <span class="x_x_p" style="font-size:14.4px; margin:0px; outline:0px">{</span>
        <span class="x_x_kn" style="font-size:14.4px; font-weight:bold; margin:0px; outline:0px; color:rgb(0,112,32)">try_files</span> <span class="x_x_nv" style="font-size:14.4px; margin:0px; outline:0px; color:rgb(187,96,213)">$uri</span> <span class="x_x_nv" style="font-size:14.4px; margin:0px; outline:0px; color:rgb(187,96,213)">$uri/</span> <span class="x_x_s" style="font-size:14.4px; margin:0px; outline:0px; color:rgb(64,112,160)">/index.php?</span><span class="x_x_nv" style="font-size:14.4px; margin:0px; outline:0px; color:rgb(187,96,213)">$args</span> <span class="x_x_p" style="font-size:14.4px; margin:0px; outline:0px">;</span>
    <span class="x_x_p" style="font-size:14.4px; margin:0px; outline:0px">}</span></pre>
>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:</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<a href="https://nginx.viraptor.info/" id="LPlnk423083">https://nginx.viraptor.info/</a><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<img size="257107" contenttype="image/png" unselectable="on" tabindex="-1" style="max-width: 100%; user-select: none;" data-outlook-trace="F:1|T:1" src="cid:7468dba8-ae19-4bfa-8d7a-ce3d05dc1e1d"><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
But a 404 is observed instead. Can anybody help please?</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
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.</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I am running everything inside docker and using nginx:1.17 image.</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<pre class="x_x_hljs" style="box-sizing:border-box; display:block; overflow-x:auto; padding:15px; color:rgba(0,0,0,0.9); margin:0px; font-size:0.75rem; border-radius:2px"><code style="box-sizing:border-box; font-family:Menlo,Consolas,"Courier New",monospace; border-radius:2px"># 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/nginx.pid --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'</code></pre>
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
<br>
<br>
</div>
</div>
</div>
</body>
</html>