且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2022-09-12 11:28:58

from :http://www.cnblogs.com/wuyou/p/3455381.html

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

反向代理(Reverse Proxy)方式是指以代理服务器来接受internet上的连接请求,然后将请求转发给内部网络上的服务器,并将从服务器上得到的结果返回给internet上请求连接的客户端,此时代理服务器对外就表现为一个服务器。

找到conf/nginx.conf文件,编辑:

(转)Nginx反向代理设置 从80端口转向其他端口
(转)Nginx反向代理设置 从80端口转向其他端口
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端口转向其他端口
(转)Nginx反向代理设置 从80端口转向其他端口

server下的结点:

listen:监听80端口

server_name:转发到哪个地址

proxy_pass:代理到哪个地址

nginx常用命令(要进入到nginx的目录):

开启:start nginx

重启:nginx -s reload




本文转自94cool博客园博客,原文链接:http://www.cnblogs.com/94cool/p/3927084.html,如需转载请自行联系原作者