• nginx http正向代理简单配置及systemd 配置


    #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 {
        #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
        #                  '$status $body_bytes_sent "$http_referer" '
        #                  '"$http_user_agent" "$http_x_forwarded_for"';
    
        #log_format upstreamlog '[$time_local] $remote_addr - $remote_user - $server_name to: $upstream_addr: $request upstream_response_time $upstream_response_time msec $msec request_time $request_time';
    
        log_format  main  '$status - $proxy_host "$request" $upstream_addr';
                          
       
    
        server
        {
            access_log  logs/access.log  main;
            listen 80;
            location /
            {
                proxy_pass   http://127.0.0.1:5000;
                proxy_read_timeout 9999;
            }
            location /api/fi/aa/v1.0/
            {
                proxy_pass   http://127.0.0.1:8080;
                proxy_read_timeout 9999;
            }
            location /api/fastdweb/runtime/v1.0/
            {
                proxy_pass   http://127.0.0.1:8080;
                proxy_read_timeout 9999;
            }
        }
           
    }
    [Unit]
    Description=The NGINX HTTP and reverse proxy server
    After=syslog.target network.target remote-fs.target nss-lookup.target
    
    [Service]
    Type=forking
    PIDFile=/run/nginx.pid
    ExecStartPre=/usr/sbin/nginx -t
    ExecStart=/usr/sbin/nginx
    ExecReload=/usr/sbin/nginx -s reload
    ExecStop=/bin/kill -s QUIT $MAINPID
    PrivateTmp=true
    
    [Install]
    WantedBy=multi-user.target

    参考:

    https://www.nginx.com/resources/wiki/start/topics/examples/systemd/

  • 相关阅读:
    Windows常用命令
    路由器命令基础使用
    《计算机网络》-CCNA命令大全
    Cisco 2960交换机配置
    vscode使用技巧
    Luogu 3321 [SDOI2015]序列统计
    Luogu 3702 [SDOI2017]序列计数
    CF 990 Educational Codeforces Round 45
    Luogu 4705 玩游戏
    CF 438E The Child and Binary Tree
  • 原文地址:https://www.cnblogs.com/wolbo/p/11518624.html
Copyright © 2020-2023  润新知