I have installed Wordpress in a subdirectory - /var/www/html/stage I am getting the following error in the error log. I think the filename being passed has the subdirectory name prepended, which should not happen.
----- 2019/12/20 15:34:00 [error] 22393#22393: *10 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 110.227.251.142, server: mywebsite.com, request: "GET /stage/%20https://mywebsite.com/stage/wp-content/uploads/2019/11/hp_slider_bg-1500x797.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "fp-academy.in", referrer: "https://fp-academy.in/stage/" 2019/12/20 15:34:00 [debug] 22393#22393: *10 http fastcgi record byte: 01 2019/12/20 15:34:00 [debug] 22393#22393: *10 http fastcgi record byte: 06 2019/12/20 15:34:00 [debug] 22393#22393: *10 http fastcgi record byte: 00 2019/12/20 15:34:00 [debug] 22393#22393: *10 http fastcgi record byte: 01 2019/12/20 15:34:00 [debug] 22393#22393: *10 http fastcgi record byte: 00 2019/12/20 15:34:00 [debug] 22393#22393: *10 http fastcgi record byte: 51 2019/12/20 15:34:00 [debug] 22393#22393: *10 http fastcgi record byte: 07 2019/12/20 15:34:00 [debug] 22393#22393: *10 http fastcgi record byte: 00 2019/12/20 15:34:00 [debug] 22393#22393: *10 http fastcgi record length: 81 2019/12/20 15:34:00 [debug] 22393#22393: *10 http fastcgi parser: 0 2019/12/20 15:34:00 [debug] 22393#22393: *10 http fastcgi header: "Status: 404 Not Found" 2019/12/20 15:34:00 [debug] 22393#22393: *10 http fastcgi parser: 0 2019/12/20 15:34:00 [debug] 22393#22393: *10 http fastcgi header: "Content-type: text/html; charset=UTF-8" 2019/12/20 15:34:00 [debug] 22393#22393: *10 http fastcgi parser: 1 2019/12/20 15:34:00 [debug] 22393#22393: *10 http fastcgi header done 2019/12/20 15:34:00 [debug] 22393#22393: *10 HTTP/1.1 404 Not Found ---/etc/nginx/sites-enabled/default looks like this server { # We're deliberately leaving this as-is to avoid conflict at the moment root /var/www/html; server_name mywebsite.com www.mywebsite.com; # rewrite ^/moodle/(.*\.php)(/)(.*)$ /moodle/$1?file=/$3 last; # rewrite ^(..php)(/)(.)$ $1?file=/$3 last; index index.php index.html index.htm login.php; # if you get errors enable the line below and find out errors in the log file. # error_log /var/log/nginx/error.log notice; location / { index index.php index.html index.htm login.php; try_files $uri /index.php?$args; } location ~ \.php$ { try_files $uri /index.php?$args; try_files $uri $script_name =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php7.0-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } location /fpelms { root /var/www/html; index index.php index.html index.htm login.php; } location /stage { root /var/www/html; index index.php; if (!-e $request_filename) { rewrite ^(.*)$ /stage/index.php?q=$1 last; } } location /doc/ { alias /usr/share/doc/; autoindex on; allow 127.0.0.1; deny all; } location ~/\.ht { deny all; } location /remotech.html { proxy_pass https://outsidedomain.com/; } location /static { proxy_pass https://outsidedomain.com/static/; } location /api/ { proxy_pass https://outsidedomain.com/api/; } location /firebase-messaging-sw.js{ proxy_pass https://outsidedomain.com/firebase-messaging-sw.js; } location /manifest.json{ proxy_pass https://outsidedomain.com/manifest.json; } location /plugins { proxy_pass https://outsidedomain.com/plugins/; } location /scripts { proxy_pass https://outsidedomain.com/scripts/; } location /styles { proxy_pass https://outsidedomain.com/styles/; } location /assets { proxy_pass https://outsidedomain.com/assets/; } location /fonts { proxy_pass https://outsidedomain.com/fonts/; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/mywebsite.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/mywebsite.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { if ($host = www.mywebsite.com) { return 301 https://$host$request_uri; } # managed by Certbot if ($host = mywebsite.com) { return 301 https://$host$request_uri; } # managed by Certbot listen 80; server_name mywebsite.com www.mywebsite.com; return 404; # managed by Certbot } ---------- Posted at Nginx Forum: https://forum.nginx.org/read.php?2,286524,286524#msg-286524 _______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx