Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

293
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda