I am running a frontend app using Vuejs and backend app with django. I am able to successfully serve both backend and frontend on the same ip using separate nginx server blocks i.e. each app is located at /etc/nginx/sites-available/frontend_app and /etc/nginx/sites-available/backend_app. Both apps are also enabled.
Visiting frontend_app.com and backend_app.com works fine however, whenever frontend_app.com tries to call the backend_app.com api, I get nginx/1.14.0 (Ubuntu) 404 Not Found error.
PS. The api call works on my localserver .i.e. calling http://127.0.0.1:000/api/path. On my production server, I change this (I think) to https://frontend.com/api/path
My questions are: is this a frontend error or nginx error? What am I doing wrong?
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 @alkadelik,
You should be able to add the configuration in one file rather than creating two. That way you should be able to call different things/folders when access different URLs with the location part.
Your backend app, on what port is it listening on? Is it 8080 or something else. You should be able to use the following
location /api {
proxy_pass http://localhost:8888/api;
}
Based on the port, just change it in the server block.
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.