• 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/;

    }

    }

  • 相关阅读:
    Failed to load resource: net::ERR_FILE_NOT_FOUND
    gulp安装详解
    npm install gulp-cli -g时npm ERR! code ECONNREFUSED
    webpack4.43
    修改cmd默认路径
    delphi设置鼠标图形
    Linux常用命令学习
    IO模型介绍 以及同步异步阻塞非阻塞的区别
    TCP的三次握手与四次挥手过程,各个状态名称与含义
    常见的设计模式详解:单例模式、工厂模式、观察者模式
  • 原文地址:https://www.cnblogs.com/ly-radiata/p/6196492.html
Copyright © 2020-2023  润新知