Question

how to setup two project in nginx ?

hello guys :

i have one vps for two site .

imaging i have www.example.com , i want when user enter www.example.com this route open wordpress and in www.example.com/page1 this route open django project , how i configure that ?


Submit an answer
Answer a question...

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!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
July 22, 2019
Accepted Answer

Hello,

You could use a reverse proxy to do that.

So in your server block you could add something like this:

location ~/page1(.*)$ {
    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $host;
    proxy_pass http://yourjangoproject.com:8001$1;
}

Hope that this helps! Bobby

thank you bro

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.