LEMP WP Subdomain App issue

I have a LEMP stack running with WP on the main domain, however, I have another PHP app as a subdomain e.g. the issue I’m having is when I try to navigate around on the app on subdomain I get redirected to the main domain which is WP.

Do I need to modify my Nginx config to achieve subdomains?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @Yizi,

Yes, you’ll need to create another Nginx config for every domain.

How Nginx works is you add as many configuration files for your domain as you want. If you have 5 domains on your droplet, then you have a configuration file for every one of them.

If you are unsure how to proceed with doing so I’ll recommend checking the following article:

When using the Nginx web server, server blocks (similar to the virtual hosts in Apache) can be used to encapsulate configuration details and host more than one domain off of a single server.

In this guide, you’ll discuss how to configure server blocks in Nginx on a server.

Regards, KFSYs