PCB 利用nginx正向代理实现上网
在PCB行业中,为了保证服务器的安全性,服务器正常都是需要与外网断开的,如果想在服务器通过浏览器下载一点东西是不行。通常作法是在一台可以上网的电脑下载文件,接着放到网络盘上,再从网络盘拷贝到服务器上。而另一种方式是用浏览器代理的方式实现上网,,这里介绍使用nginx正向代理实现上网.
一.查找DNS服务器IP
nginx正向代理时配置用


二.修改nginx.conf配置文件

#user nobody;
worker_processes 1; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; 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"'; #access_log logs/access.log main; sendfile on;
#tcp_nopush on; #keepalive_timeout 0;
keepalive_timeout 65; #gzip on; server {
#正向代理DNS服务器IP CMD=> ipconfig/all 来查看
resolver 192.168.203.9;
#正向代理超时时间
resolver_timeout 5s;
#监听端口
listen 8999;
location / {
# 配置正向代理参数
proxy_pass $scheme://$host$request_uri;
# 解决如果URL中带"."后Nginx 503错误
proxy_set_header Host $http_host;
# 配置缓存大小
proxy_buffers 256 4k;
# 关闭磁盘缓存读写减少I/O
proxy_max_temp_file_size 0;
# 代理连接超时时间
proxy_connect_timeout 30;
# 配置代理服务器HTTP状态缓存时间
proxy_cache_valid 200 302 10m;
proxy_cache_valid 301 1h;
proxy_cache_valid any 1m;
} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#} }
三.启动nginx.exe并本机打开Web网页
查看nginx Web应用是否正常
http://192.168.204.158:8999/

四.浏览器代理设置
nginx代理不支持https

PCB 利用nginx正向代理实现上网的更多相关文章
- Nginx正向代理让无法直接上网的机器通过代理上网
Nginx正向代理让无法直接上网的机器通过代理上网 在阿里云平台买了几台ECS.但是只要其中一台开通了公网.由于要初始化系统环境,需要网络安装相关依赖. Nginx正向代理配置: 一.Nginx 正向 ...
- nginx正向代理,反向代理,透明代理(总结)
1正向代理 正向代理,也就是传说中的代理,他的工作原理就像一个跳板, 简单的说, 我是一个用户,我访问不了某网站,但是我能访问一个代理服务器 这个代理服务器呢,他能访问那个我不能访问的网站 于是我先连 ...
- Nginx正向代理代理http和https服务
Nginx正向代理代理http和https服务 1. 背景需求 通过Nginx正向代理,去访问外网.可实现局域网不能访问外网的能力,以及防止在上网行为上,留下访问痕迹. 2. 安装配置 2.1安装 w ...
- nginx正向代理
通过把Nginx设置为正向代理,我们就可以在局域网中用运行着Nginx的主机作为正向代理服务器了.那什么是正向代理和反向代理呢?正向代理和反向代理-百度百科 正向代理:如果把局域网外的Internet ...
- nginx 正向代理配置
需求场景:从以下俩张图可以比较直观的理解正向代理的作用(在其他文章中会表示为“http代理”,注意当前文档的配置不支持https代理) Nginx正向代理配置文件: server{ listen de ...
- 使用nginx 正向代理暴露k8s service && pod ip 外部直接访问
有时在我们的实际开发中我们希望直接访问k8s service 暴露的服务,以及pod的ip 解决方法,实际上很多 nodeport ingress port-forword 实际上我们还有一种方法:正 ...
- Nginx笔记总结十三:nginx 正向代理
server { listen ; location / { resolver 202.106.0.20 202.106.119.116; resolver_timeout 30s; proxy_pa ...
- CentOS 7 配置 Nginx 正向代理 http、https 最详解
手头项目中有使用到 nginx,因为使用的三方云服务器,想上外网需要购买外网IP的,可是有些需要用到外网却不常用的主机也挂个外网IP有点浪费了,便想使用nginx的反向代理来实现多台内网服务器使用一台 ...
- Nginx正向代理和反向代理
关于代理 说到代理,首先我们要明确一个概念,所谓代理就是一个代表.一个渠道: 此时就设计到两个角色,一个是被代理角色,一个是目标角色,被代理角色通过这个代理访问目标角色完成一些任务的过程称为代理操作过 ...
随机推荐
- java面试题链接
http://blog.csdn.net/jackfrued/article/details/17339393
- Xcode5编译ffmpeg
命令行安装FFmpeg:git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg(或:到https://github.com/gabriel/ffmpeg ...
- Stuts2学习——HelloWorld
这两天从对Struts一窍不通到成功运行HelloWorld,在SSH这条路上迈出了第一步. 下面我把我的第一个Struts程序放上来: 一.新建web project,配置文件等准备工作 1. 新建 ...
- [Algorithm] 10. Reverse Integer
Description Given a 32-bit signed integer, reverse digits of an integer. Example Example 1: Input: 1 ...
- <MySQL>入门七 存储过程和函数
-- 存储过程和函数 /* 存储过程和函数:类似java中的方法 好处: 1.提高代码的重用性 2.简化操作 */ /* 存储过程 含义:一组预先编译好的SQL语句的集合.理解成批处理语句 1.提高代 ...
- Python学习第二阶段Day2,模块time/datetime、random、os、sys、shutil
1.Time. Datetime(常用) UTC时间:为世界标准时间,时区为0的时间 北京时间,UTC+8东八区 import time print(time.time()) # timestamp ...
- Network----轮询
轮询: 定时每隔多长时间刷新一次,但是,7X24的对服务器的压力会过大,因为在夜间或者是流量低峰期时,他还要持续工作. 客户端发一次请求,服务器就要相应一次. 长轮询: 和轮询的模式不同,长轮询是一次 ...
- 基于XML文档的声明式事务配置
<!-- 配置事务切面 --> <aop:config> <aop:pointcut expression="execution(* com.atguigu.t ...
- 什么是js严格模式?
[03] 严格模式 ECMAScript 5 引入了严格模式(strict mode)的概念.严格模式是为JavaScript 定义了一种不同的解析与执行模型.在严格模式下,ECMAScript 3 ...
- 使用pycharm学习django纪实
之前已经下了python3.7 首先官网下载pycharm专业版,然后利用学生邮箱激活 新建django项目,使用虚拟环境就好了,方便之后的服务器部署(大概 找到博客开始学习:https://blog ...