server {
server_name www.domain.com domain.com;
charset utf-8;
location /blog/ {
proxy_pass https://blog.domain.com;
proxy_redirect off;
proxy_set_header Host $host;
}
location / {
proxy_pass http://localhost:3000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 1m;
proxy_connect_timeout 1m;
}
}
server {
server_name blog.domain.com www.blog.domain.com;
root /var/www/blog;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}
wp-config.php
define('WP_HOME','https://domain.com/blog/');
define('WP_SITEURL',
define('WP_HOME','https://domain.com/blog/');
define('WP_SITEURL','https://domain.com/blog/');
$_SERVER['REQUEST_URI'] = str_replace("/wp-admin/", "/blog/wp-admin/", $_SERVER['REQUEST_URI']);