How to run wordpress blog from subfolder

By | December 16, 2021
Spread the love

Common problem when your main website running different platform like java and you need to install wordpress blog with same domain but as subfolder.

For example: Website url https://www.{domain}.com running on Java nginx server. Now you want to run wordpress in php apache server as sub folder like https://www.{domain}.com/blog.

So you can add following nginx config setting to re route path.

nginx.conf

## # Virtual Host Configs 
## include /etc/nginx/conf.d/*.conf; 
include /etc/nginx/sites-enabled/*; 

root /var/www/html; 
server {    
   listen 443 ssl;    
   server_name {{www.example.com}};    
   ssl_certificate nginx-selfsigned.crt;    
   ssl_certificate_key nginx-selfsigned.key;    
   location / { proxy_pass https://127.0.0.1:8443; }    
   location /blog { proxy_pass https://{IP address}/{subfolder}/; }  
}