您尚未登录。

#1 2018-12-18 08:31:40

caizhengzhu
管理员

openwrt安装nginx代理上网

原文:http://blog.mindcont.com/2016/12/26/nginx-proxy-lan/

1、登录OpenWrt 安装nginx
在windows下使用SSH工具,如Putty等,在Host name 填写192.168.1.1,端口22 ,然后点击 Open.

使用opkg安装 nginx ,输入下面的指令

opkg update
opkg install nginx

2、配置 nginx
这里我们首先将nginx原本配置文件nginx.conf备份为nginx.conf.backup,后修改里面的内容,配置为HTTP反向代理模式,选择8080为服务监听端口。

cd /etc/nginx
cp nginx.conf nginx.conf.backup
vi nginx.conf

将下面的内容替换nginx.conf中默认的内容

user nobody nogroup;
worker_processes  1;

events {
    worker_connections  1024;
}

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

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    gzip  on;
    #include /etc/nginx/conf.d/*.conf;

    resolver 114.114.114.114;
    server {
        listen       8080;
        location / {
              proxy_pass $scheme://$http_host$request_uri;
         }
    }
}

修改完成后,按 esc ,输入:wq! 保存
紧接着,启动nginx

cd /etc/init.d
./nginx start

浏览器就可以设置openwrt 的ip地址,端口为:8080上网了。

离线

在此主题中在线的注册用户:0, 访客:1
[Bot] ClaudeBot

论坛底部