A project previously deployed by docker on Aliyun has now deployed another node project. How to distinguish it?

the new node project is very simple, just
app.post ("/ upload", router.doPost);
app.get ("/ getat", router.doGetAT);

actually wants to expose these two interfaces.

my public network ip of Aliyun is http://112.74.191.12. I deployed a project before, and now I access it through" http://112.74.191.12/getat. My local test is good:

clipboard.png
pm2:

clipboard.png
what should I do now? Thank you for your advice.

it seems that nginx? should be used. I don"t quite understand. How should I configure it?


  • the old project has used port 80 while the new node project has enabled port 3000. The access method should be http://ip:3000/getat
  • .
  • if you want to access it in the form of http://112.74.191.12/getat, you can use nginx to proxy forward according to location
  1. the old project abandoned port 80 and used nginx as port 80, because there can only be one port 80.
  2. New port is enabled for the old project. Through nginx port configuration, access to nginx will be forwarded to the old project
  3. the new node project is forwarded by proxy according to location

location configuration:
location / getat {

    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://127.0.0.1:3000;

}

Menu