how to setup two project in nginx ?

July 22, 2019 142 views
Nginx Ubuntu 18.04

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 ?

2 Answers
bobbyiliev MOD 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

Have another answer? Share your knowledge.