nchambers
Forum Replies Created
-
That worked perfectly. Thanks!
Forum: Networking WordPress
In reply to: Local WordPress 5.1.1 multisite with NginxHi Pothi, apologies for the late reply. It doesn’t look like I do have debug enabled, so I’ll get that done at some point (although it will have to be later now). Thanks for your help, I learned a lot even though I couldn’t get this resolved.
Forum: Networking WordPress
In reply to: Local WordPress 5.1.1 multisite with NginxSorry, my current if block is actually:
if ( !-e $request_filename ) { rewrite ^/wordpress/[_0-9a-zA-Z-]+(/wp-(content|admin|includes).*) /wordpress$1 break; rewrite ^/wordpress/[_0-9a-zA-Z-]+(/.*\.php)$ /wordpress$1 break; }
I had changed it from !-e -> -e, just to confirm that wasn’t the problem, since I had exhausted everything else I could think of
Forum: Networking WordPress
In reply to: Local WordPress 5.1.1 multisite with NginxThanks for the information about the headers. I’ll fix that and check out the if article. I did indeed accidentally typo the _ in my config, but the issue is still occurring without it. New if block:
if ( -e $request_filename ) { rewrite ^/wordpress/[_0-9a-zA-Z-]+(/wp-(content|admin|includes).*) /wordpress$1 break; rewrite ^/wordpress/[_0-9a-zA-Z-]+(/.*\.php)$ /wordpress$1 break; }
I enabled the rewrite log, but don’t see any of the rewrites happening in my error log (which is why I attempted the add_header route actually). Thanks for the help, I’m really at a loss here as to what is going on.
- This reply was modified 5 years, 11 months ago by nchambers.
Forum: Networking WordPress
In reply to: Local WordPress 5.1.1 multisite with NginxThanks Pothi! That is all great information. I didn’t realize it is indeed a complicated setup. I studied your repository (which is great by the way, thank you for linking that), and believe I have extracted the necessary parts from it for my setup, but I’m still seeing the same behavior as before. Would you mind taking a look at my updated config?
http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; log_format compression '$time_local - "$uri" $status "$http_referer" $request_filename'; access_log /Users/nicholas.chambers/log/nginx/access.log compression; error_log /Users/nicholas.chambers/log/nginx/error.log; upstream fpm { server 127.0.0.1:9000; } map $http_accept $webp_suffix { default ""; "~*webp" ".webp"; } server { listen 80; server_name localhost; return 301 https://$host$request_uri; } server { listen 443 ssl http2; server_name localhost; # ssl directives redacted root /Users/nicholas.chambers; location /dl { autoindex on; add_header X-location "static dl folder"; types { text/plain sh; application/pdf pdf; } } location /wordpress { index index.php; rewrite_log on; add_header X-location "wordpress blogs"; if ($uri ~ "files") { rewrite ^/wordpress/(?:.*/)?files/(.+) /wordpress/wp-includes/ms-files.php?file=$1; } if ( -e $request_filename ) { add_header X-debug "did rewrite"; rewrite ^/wordpress/[_0-9a-zA-Z-]+_(/wp-(content|admin|includes).*) /wordpress$1 break; rewrite ^/wordpress/[_0-9a-zA-Z-]+(/.*\.php)$ /wordpress$1 break; } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; include "fastcgi.conf"; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_index index.php; fastcgi_pass fpm; } location /wordpress { try_files $uri $uri/ /wordpress/index.php$is_args$args; } location ~ \.(?:css|js)$ { add_header X-thebug "got a resource"; expires max; } location ~ \.(?:ttf|ttc|eot|woff|woff2|otf|svg)$ { expires max; } location ~ \.(?:gif|ico|webp)$ { valid_referers none blocked localhost; if ($invalid_referer) { return 403; } expires max; } location ~* ^.+\.(png|jpe?g)$ { valid_referers none blocked localhost; if ($invalid_referer) { return 403; } try_files $uri$webp_suffix $uri =404; expires max; } location ~ \.(?:rss|atom)$ { expires 600s; } } location ~ /w/(.*)(\.php)?$ { index index.php index.html; try_files $uri $uri.php /w/index.php =404; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; } } }
The /w block is for a mediawiki install I am messing around with, and the /dl is for a directory index of a different folder. I don’t believe either are relevant, but included them just in case. The above configuration works fine with nginx:
nicholas-chambers:~ nicholas.chambers$ nginx -t nginx: the configuration file /Users/nicholas.chambers/nginx/conf/nginx.conf syntax is ok nginx: configuration file /Users/nicholas.chambers/nginx/conf/nginx.conf test is successful nicholas-chambers:~ nicholas.chambers$ nginx -s reload nicholas-chambers:~ nicholas.chambers$
However, whenever I try to curl one of the resources, I get an error:
nicholas-chambers:~ nicholas.chambers$ curl -sSI https://localhost/wordpress/multisite/wp-content/plugins/ghostkit/assets/vendor/font-awesome/all.min.js HTTP/2 404 server: nginx/1.15.8 date: Tue, 16 Apr 2019 20:17:43 GMT content-type: text/html content-length: 153
With this entry in my error.log
2019/04/16 15:25:30 [error] 32009#0: *2988 open() "/Users/nicholas.chambers/wordpress/multisite/wp-content/plugins/ghostkit/assets/vendor/font-awesome/all.min.js" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "HEAD /wordpress/multisite/wp-content/plugins/ghostkit/assets/vendor/font-awesome/all.min.js HTTP/2.0", host: "localhost"
I also don’t see the debug headers I added for the rewrite.
Forum: Networking WordPress
In reply to: Local WordPress 5.1.1 multisite with NginxThe good news is it didn’t break anything (the same links I mentioned above still work), but https://localhost/wordpress/multisite/ and https://localhost/wordpress/multisite/wp-admin/ still show the same behavior :/. Thanks for simplying the try_files though! I was wondering how that could be more managable.