当前位置: 首页 > news >正文

昆山兼职做网站微信小程序开发平台官网

昆山兼职做网站,微信小程序开发平台官网,河南郑州网站推广优化外包,wordpress怎么建立二级菜单文章目录 NginxNginx主要作用转发配置相关问题参考推荐阅读 Nginx Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器,同时也提供了IMAP/POP3/SMTP服务。Nginx是由伊戈尔赛索耶夫为俄罗斯访问量第二的Rambler.ru站点(俄文:Рамбл…

文章目录

    • Nginx
    • Nginx主要作用
    • 转发配置
    • 相关问题
    • 参考
    • 推荐阅读

Nginx

Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器,同时也提供了IMAP/POP3/SMTP服务。Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Rambler.ru站点(俄文:Рамблер)开发的,公开版本1.19.6发布于2020年12月15日
其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、简单的配置文件和低系统资源的消耗而闻名。2022年01月25日,nginx 1.21.6发布。
Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,在BSD-like 协议下发行。其特点是占有内存少,并发能力强,事实上nginx的并发能力在同类型的网页服务器中表现较好。

Nginx主要作用

  1. CI/DI
  2. 转发
  3. 负载均衡

本文主要内容:转发

转发配置

  1. tcp端口监听是唯一的,nginx要在哪个端口监听,是不能被占用的。配置一个server节点,就等于在server节点启动了一个tcp监听。
  2. nginx同一个端口可以监听多个不同host的请求。配置文件中可以重复写同一个端口的server节点。

#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;
}stream {  server {listen  13389;  #本地请求端口proxy_pass x.x.x.x:3389;  #服务器远程桌面端口}server {listen  6672;  #本地请求端口proxy_pass  x.x.x.x:5672;  #rabbitmq}}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       8888;server_name  localhost;#charset koi8-r;#access_log  logs/host.access.log  main;#数采正式/测试接口  不走https了 不用配置跨域访问#location /RTP/DaqApi {#    #Proxy Settings#    add_header Access-Control-Allow-Origin $http_origin;#    add_header Access-Control-Allow-Headers *;#    add_header Access-Control-Allow-Methods *;#    proxy_redirect     off;#    proxy_http_version 1.1;#    proxy_set_header   Host             $host:$server_port;#    proxy_set_header   X-Real-IP        $remote_addr;#    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;#    proxy_set_header   X-Forwarded-Proto $scheme; #    proxy_set_header   Upgrade $http_upgrade;#    proxy_set_header   Connection  "upgrade"; #    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;#    proxy_max_temp_file_size 0;#    proxy_connect_timeout      90;#    proxy_send_timeout         90;#    proxy_read_timeout         90;          #    proxy_pass https://x.x.x.x:9433;#}location /RTPDaq/Api/{proxy_pass  http://x.x.x.x:9433/; proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;}#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中配置proxy_pass时,如果是按照^~匹配路径时,要注意proxy_pass后的url最后的/,当加上了/,相当于是绝对根路径,则nginx不会把location中匹配的路径部分代理走;如果没有/,则会把匹配的路径部分也给代理走。

location ^~ /static_js/ 
{ 
proxy_cache js_cache; 
proxy_set_header Host js.test.com; 
proxy_pass http://js.test.com/; 
}

如上面的配置,如果请求的url是http://servername/static_js/test.html
会被代理成http://js.test.com/test.html

而如果这么配置

location ^~ /static_js/ 
{ 
proxy_cache js_cache; 
proxy_set_header Host js.test.com; 
proxy_pass http://js.test.com; 
}

则会被代理到http://js.test.com/static_js/test.htm

当然,我们可以用如下的rewrite来实现/的功能

location ^~ /static_js/ 
{ 
proxy_cache js_cache; 
proxy_set_header Host js.test.com; 
rewrite /static_js/(.+)
/
1 break; 
proxy_pass http://js.test.com; 
} 

参考

Nginx配置proxy_pass转发的/路径问题

推荐阅读

Nginx常用配置及代理转发

http://www.khdw.cn/news/47383.html

相关文章:

  • 网站怎样做有利于seo拉新推广怎么找渠道
  • 外贸网站搭建服务商外链网盘源码
  • 那个网站做代买武汉seo网站排名
  • 青岛做教育的网站云南优化公司
  • 做微商进哪个网站安全吗最近的新闻事件
  • 网站制作价格表模板网站优化有哪些技巧
  • 网站建设论文新手怎么学网络运营
  • php做的网站有哪些新闻稿代写平台
  • 沈阳网站模板手机百度最新正版下载
  • asp做企业网站很好啊新闻株洲最新
  • 济南网站制作seo建设
  • 外贸邮箱用哪个比较好昆明seo工资
  • 做网站准备什么万网官网
  • 大连做网站 智域武汉网站seo德升
  • 手工活外包加工官方网麒麟seo
  • 自己做网站需要学什么软件下载网络舆情管理
  • wordpress+示例seo管家
  • 如何自做网站如何做网站优化seo
  • 餐饮vi设计手册成都seo培训
  • 沈阳微营销网站制作微信搜一搜排名优化
  • 滨江网站制作运营推广计划怎么写
  • 网站高中建设工具黑帽seo排名优化
  • 全网型网站建设方案软考培训机构排名
  • 贵阳网站维护培训电子商务营销策略
  • 新乡 网站开发百度快照是干什么的
  • 江苏威达建设有限公司网站电销名单渠道在哪里找
  • 网络设计师培训平台浙江seo推广
  • 深圳沙井做网站爱站网关键词工具
  • 电子商务网站建设大作业b2b网站免费推广平台
  • wordpress手机显示不了图片seo外链发布技巧