Nodejs running at Gate 80 with Apache

Asked

Viewed 684 times

5

Well, it’s like this, whenever I want to use socket.io I have to use some port, so whenever I want to have access to the web page that works with the socket.io I have to go to : wwwwww.meusite.com:.

What I would like to know is if I can remove the port, or if at least there is some solution to avoid this problem, given that apache on my server, already uses port 80.

  • 2

    It is not "no port", there is always port, but the default browser hides the 80 and, if I am not mistaken the 8080 as well. You can test this if you go to www.exemplo.com:80. But I think what you want is this: https://www.digitalocean.com/community/questions/how-can-i-get-node-js-to-listen-on-port-80 or http://stackoverflow.com/a/6109171/3162303. You can edit the question to be clearer in this regard

  • Just use door 80

  • The problem is that if you use port 80, it conflicts with the apache I have on the server.

  • If Node is not the only server in the environment you should do a proxy (with or without SSL)

  • What do you mean, proxy? You can give more details...

  • 1

    @Gonçalo must have to configure the apache server to serve this app on that port. I put some links above that can help.

  • If I have a different dedicated ip, which points to the same server, I can have apache and nodejs running with the same port, but each with the corresponding ip?

  • @Gonçalo Now with your edition my answer was partially meaningless, please do not make this type of edition that changes the initial meaning of the question.

  • I’m sorry jbueno, I changed to try to specify my problem better.

Show 4 more comments

1 answer

3


Every request is made on a port, what happens is that the browser "hides" ports 80 and 443 which are the two standards of the HTTP protocol - without SSL and with SSL, respectively.

By definition, if you do not specify any ports in an HTTP request, this request will be made at port 80.

  • The problem is that if you use port 80, it conflicts with the server apache port.

  • 1

    Either you disable apache or make it no longer answer at port 80, otherwise it doesn’t have much to do.

  • 1

    You must proxy on Apache

  • 1

    Yeah, or redirect from Apache pro Node.

  • If I have a different dedicated ip, which points to the same server, I can have apache and nodejs running with the same port, but each with the corresponding ip?

  • I managed to solve the problem, I had misplaced the script in index.html, which caused it to be incorrectly read by the socket.io, after all I can use any port, which does not occur the problem.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.