Heim  >  Fragen und Antworten  >  Hauptteil

Was ist die URL hinter „proxy_pass“ des Nginx-Reverse-Proxys?

Was ist die URL hinter „proxy_pass“ des Nginx-Reverse-Proxys? Die im folgenden Beispiel geschriebene 127.0.0.1 stellt den lokalen Computer dar? Sich selbst vertreten? Was ist die Funktion?

    location / {
        proxy_http_version       1.1;

        add_header               Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
        add_header               X-Frame-Options deny;
        add_header               X-Content-Type-Options nosniff;
        add_header               Content-Security-Policy "default-src 'none'; script-src 'unsafe-inline' 'unsafe-eval' blob: https:; img-src data: https: http://ip.qgy18.com; style-src 'unsafe-inline' https:; child-src https:; connect-src 'self' https://translate.googleapis.com; frame-src https://disqus.com https://www.slideshare.net";
        add_header               Public-Key-Pins 'pin-sha256="YLh1dUR9y6Kja30RrAn7JKnbQG/uEtLMkBgFF2Fuihg="; pin-sha256="aef6IF2UF6jNEwA2pNmP7kpgT6NFSdt7Tqf5HzaIGWI="; max-age=2592000; includeSubDomains';
        add_header               Cache-Control no-cache;

        proxy_ignore_headers     Set-Cookie;

        proxy_hide_header        Vary;
        proxy_hide_header        X-Powered-By;

        proxy_set_header         X-Via            QingDao.Aliyun;
        proxy_set_header         Connection       "";
        proxy_set_header         Host             imququ.com;
        proxy_set_header         X-Real_IP        $remote_addr;
        proxy_set_header         X-Forwarded-For  $proxy_add_x_forwarded_for;

        proxy_pass               http://127.0.0.1:9095;
    }
曾经蜡笔没有小新曾经蜡笔没有小新2712 Tage vor660

Antworte allen(4)Ich werde antworten

  • 滿天的星座

    滿天的星座2017-05-16 17:19:42

    IP后面还有一个端口
    把到80端口的请求转发到9095端口,因为nginx本身没法处理java/php/python(举例子而已)的请求,需要交给tomcat,php-fpm或者wsgi等等来处理,所以需要反向代理后端的服务,个人理解

    Antwort
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-16 17:19:42

    我觉得也可以写其它IP吧,不一定是本机,只要本机能访问到的都行

    Antwort
    0
  • 阿神

    阿神2017-05-16 17:19:42

    可以其他IP,目的就是实现了代理,简单理解为cdn也可以不过功能是完整的可用的

    Antwort
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 17:19:42

    127.0.0.1是指本机,为什么要自己代理自己?比如服务器上运行的是node.js服务端,但是node.js不是专门的Web服务器,所以需要Nginx来反向代理一下,这样对于外部访问的控制要方便很多,而且Nginx缓存可以提高性能。

    Antwort
    0
  • StornierenAntwort