S
S
Smilley2017-06-15 12:58:33
Computer networks
Smilley, 2017-06-15 12:58:33

Can two programs work on the same port but on different IPs?

Good afternoon, tell me, please, is it possible to run both Apache2 and nginx on a computer so that they simultaneously listen to the 80th port, but on different IP addresses?
Now nginx gives an error that Cannot assign requested address.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
nirvimel, 2017-06-15
@Smilley

In the Nginx config we write:
Documentation
In the Apache config we write:
Documentation
In the browser go to 127.0.0.42 and 127.0.0.43. We observe the difference.

I
Igor, 2017-06-15
@DMGarikk

Yes, please read the setup manual.

A
Alexey Cheremisin, 2017-06-15
@leahch

You can, but it's better to hang Apache on port 8888, for example, and proxy to it from port 80 through nginx.
This is a very common configuration, and you won't need to bother with binding to different addresses. Well, the config for the enginx is an order of magnitude simpler ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question