码迷,mamicode.com
首页 > 其他好文 > 详细

Nginx反向代理设置 从80端口转向其他端口

时间:2016-10-11 10:45:17      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:

 

 

[root@localhost bin]# netstat -lnutp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      1552/nginx          
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1408/sshd           
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1487/master         
tcp        0      0 ::ffff:127.0.0.1:8005       :::*                        LISTEN      6389/java           
tcp        0      0 :::8009                     :::*                        LISTEN      6389/java           
tcp        0      0 :::8080                     :::*                        LISTEN      6389/java           
tcp        0      0 :::22                       :::*                        LISTEN      1408/sshd           
tcp        0      0 ::1:25                      :::*                        LISTEN      1487/master         
udp        0      0 0.0.0.0:68                  0.0.0.0:*                               6042/dhclient       
[root@localhost bin]# java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            proxy_pass http://127.0.0.1:8080;
            #root   html;
            #index  index.html index.htm;
        }

网上找的一个配置:

worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;


    server {
        listen       80;
        server_name  127.0.0.1:8080;

        location / {

            proxy_pass   http://127.0.0.1:8080;
        }

    }

}

 

技术分享

Nginx反向代理设置 从80端口转向其他端口

标签:

原文地址:http://www.cnblogs.com/bass6/p/5948199.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!