zoukankan      html  css  js  c++  java
  • nginx

    just a simple example, for more information -> http://nginx.org/en/docs/.
    1.vi /etc/yum.repos.d/nginx.repo

    2. find repo from http://nginx.org/packages, choose version according to your system. save it.
    [nginx]
    name=nginx repo
    baseurl=http://nginx.org/packages/[OS(for example:centos)]/$releasever/$basearch/
    gpgcheck=0
    enabled=1

    3.yum install nginx

    (yum update)

    4.config nginx
    u can edit nginx.conf directly or use "include" in nginx.conf
    (1)root
    A location context can contain directives that define how to resolve a request – either serve a static file or pass the request to a proxied server.
    (2)proxy_pass
    The proxy_pass directive passes the request to the proxied server accessed with the configured URL. The response from the proxied server is then passed back to the client.
    (3)proxy_set_header (NGINX Reverse Proxy)
    By default, NGINX redefines two header fields in proxied requests, “Host” and “Connection”,
    and eliminates the header fields whose values are empty strings. “Host” is set to the $proxy_host variable, and “Connection” is set to close:
    proxy_set_header Host $proxy_host;
    proxy_set_header Connection close;
    To change these setting, as well as modify other header fields, use the "proxy_set_header" directive.
    This directive can be specified in a location or higher.
    It can also be specified in a particular server context or in the http block

    server {
    listen 80;

    server_name www.system-in-motion.com;
    root [location context];

    location / {
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://127.0.0.1:8080/;

    }

    }

  • 相关阅读:
    Guava的学习2
    Guava的学习1
    数据结构
    二叉搜索树的第k个结点
    滑动窗口的最大值
    僵尸进程和孤儿进程
    fork和vfork,exec
    扑克牌顺子
    字符流中第一个不重复的字符
    表示数值的字符串
  • 原文地址:https://www.cnblogs.com/ly-radiata/p/6196492.html
Copyright © 2011-2022 走看看