I have a LEMP stack running with WP on the main domain, however, I have another PHP app as a subdomain e.g. domain.com/subdomain 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?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.