nginx反向代理
来源:互联网 发布:链家端口报买系统图片 编辑:程序博客网 时间:2024/06/05 22:40
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 { listen 8089; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm;proxy_set_header Access-Control-Request-Headers "*";} #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; # } #} upstream 192.168.1.52{ server 10.174.130.146:6080; #代理的arcgis server服务器的地址和端口号 server 10.246.132.249:8080; #OneMapServer,RemoteTokenServer server 10.174.130.142; #代理统一数据服务}server { listen 8089; #反向代理后的端口号 server_name 192.168.1.52; location /arcgis/rest/services/ { proxy_pass http://192.168.1.52/arcgis/rest/services/; proxy_redirect default; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_next_upstream error timeout invalid_header http_500 http_504 http_404; } location /OneMapServer/ { proxy_pass http://192.168.1.52/OneMapServer/; proxy_redirect default; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_next_upstream error timeout invalid_header http_500 http_504 http_404; } location /RemoteTokenServer/ { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Headers' 'Content-Type,Accept'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE'; proxy_pass http://192.168.1.52/RemoteTokenServer/; proxy_redirect default; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_next_upstream error timeout invalid_header http_500 http_504 http_404; }location /IPMSAPI/ { proxy_pass http://192.168.1.52/IPMSAPI/; proxy_redirect default; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_next_upstream error timeout invalid_header http_500 http_504 http_404; } }}启动ngindx反向代理的doc命令:
1.进入nginx目录根目录并在该目录运行cmd命令行窗口
2.在cmd窗口输入:start nginx
3.在cmd命令窗口输入:tasklist /fi "imagename eq nginx.exe"
4.打开任务管理器窗口,能找到nginx.exe进程说明反向代理已启动成功
5.通过浏览器测试反向代理是否成功
阅读全文
0 0
- Nginx反向代理Nginx
- Nginx反向代理Nginx
- nginx 反向代理
- nginx 反向代理
- Nginx 反向代理https
- Nginx 反向代理设置
- nginx反向代理
- nginx 反向代理上网
- Nginx 反向代理设置
- NGINX实现反向代理
- nginx TCP 反向代理
- nginx 反向代理
- nginx反向代理配置
- nginx反向代理原理
- nginx反向代理配置
- Nginx反向代理设置
- Nginx 反向代理
- nginx 反向代理设置
- LeetCode 268. Missing Number
- linux中shell变量$#,$@,$0,$1,$2的含义解释(转载)
- java直接访问链接url,并对返回的json字符串进行解析
- python 随机生成验证码
- Ubuntu Nodejs 环境
- nginx反向代理
- android图片压缩办法总结
- JAVA设计模式五之装饰模式
- Kotlin基础
- 模拟滚动条控制内容的滚动
- Memcached的基本操作
- 项目实训第二周(1)--数据库表的设计与数据库建立
- Openvswitch手册(5): VLAN and Bonding
- C++多线程