I have a Wordpress site on root
, and a second Wordpress site in subdirectory /blog
. I have been tasked with migrating these two Wordpress installs from one server to another. Here is the folder structure on the Ubuntu server:
/var/www/html/example.com/html # WP install 1
/var/www/html/example.com/html/blog # WP install 2
The old server works fine, however visiting https://example.com/blog
(or any folder within) on the new server returns a 404
error.
Below is the configuration file, /etc/nginx/sites-available/example.com
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/example.com/html;
index index.html index.htm index.php;
server_name example.com www.example.com;
location / {
try_files $uri $uri/ /index.php?$args;
}
location /blog {
try_files $uri $uri/ /blog/index.php?$args;
}
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
}
While I have been very careful to ensure the databases and directory structure match across the servers, one difference is the php has been updated on the new server from 7.0
to 7.4
.
I have tried a variety of different configurations to get this to work, but so far I have not been successful. Any assistance would be greatly appreciated.
question from:
https://stackoverflow.com/questions/65851812/second-wordpress-site-in-subdirectory-of-first-wordpress-site-returns-404-using 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…