Home  >  Article  >  Backend Development  >  Nginx non-80 port configuration nginx 80 port forwarding nginx does not use port 80 nginx port 80 is occupied

Nginx non-80 port configuration nginx 80 port forwarding nginx does not use port 80 nginx port 80 is occupied

WBOY
WBOYOriginal
2016-07-29 08:53:542066browse


If the listening port of nginx is not the default port 80, and is changed to another non-80 port, the request.getServerPort() method in the back-end service tomcat cannot obtain the correct port number and still returns to port 80. The client may not get the correct redirect URL when responding.sendRedirect().

So the correct configuration:

?

1

2

3

4

5

6

7

8

9

10

server {

listen 8080;

server_name localhost;

location / {

proxy_pass http:// 192 .168.1.100:8081; set_header -For $proxy_add_x_forwarded_for;

​​​​}<span></span>

}

The above introduces the Nginx non-80 port configuration, including nginx and 80 port content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn