A
A
andymitrich2015-09-22 19:18:03
Nginx
andymitrich, 2015-09-22 19:18:03

Is it possible to use one port for Nginx virtual hosts?

Me so, for self-education. Now I just specify different ports for hosts. Tell me, pliz, can I specify one or not? And then how to destroy it. You can click on the manual, where to look)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
TyzhSysAdmin, 2015-09-22
@POS_troi

For self-development, you need to read the documentation or at least google a dozen ready-made configurations and see.
Yes.

S
Stanislav Makarov, 2015-09-22
@Nipheris

> You can click on the manual, where to look)
In HTTP/1.1 and above there is a mandatory header Host , which indicates the domain name of the site to which the request is made. Using it, the web server can always determine which virtual host the request came to:

The "Host" header field in a request provides the host and port information from the target URI, enabling the origin server to distinguish among resources while servicing requests for multiple host names on a single IP address.
.....
A client MUST send a Host header field in all HTTP/1.1 request messages.
Ports other than 80 are almost never used on the public web.
If, from the point of view of nginx, we look at the server_name directive , this is exactly what it was made for.

A
Artem Spiridonov, 2015-09-22
@customtema

Hmm, everything looks outward through 80 and 443, inside through sockets.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question