Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

292
Views
Node.js app and Apache php back-end at the same server

I have a VPS which runs under CentOS 7. The idea is: to have under maindomain.com node.js front-end app deployed while under api.maindomain.com to have php back-end deployed. Is it possible? Say, add server blocks to Nginx: reverse proxy localhost:4000 for node.js app and the other block for localhost:80 for php back-end.

Maybe there exists the other solution, I don't know, I would appreciate any ideas! The main goal: to have both app at the same server.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Solution 1 with www.maindomain.com + api.maindomain.com

Frontend

server {
    listen 80;
    server_name www.maindomain.com;

    location / {
        root /path/to/your/files;
        try_files  /index.html;
    }
}

Backend php API

server {
    listen 80;
    server_name api.maindomain.com;

    location / {
        proxy_pass http://localhost:4000;
    }

}

Solution 2 everything on same domain, www.maindomain.com

server {
    listen 80;
    server_name www.maindomain.com;

    location /api {
        proxy_pass http://localhost:4000/api;
    }

    location / { # always at the end, like wildcard
        root /path/to/your/files;
        try_files  /index.html;
    }
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!