nginx-配置文件样例

1, 总配置文件

user nobody nobody;
worker_processes  6;
worker_rlimit_nofile    652144;

error_log  /etc/nginx-idfa/logs/error.log crit;
pid /run/nginx.pid;

events {
    use epoll;
    multi_accept on;
    worker_connections  102400;
}

http {
    include /etc/nginx/mime.types;
    client_max_body_size 1m;
    sendfile     on;
    tcp_nopush   on;
    access_log   off;
    keepalive_timeout  60;

    proxy_ignore_client_abort on;

    limit_req_zone $binary_remote_addr zone=allips:200m rate=90r/m;

    upstream idfa_server {
        server 10.110.157.48:9003;
    server 10.110.157.48:9004;

        keepalive 1000;
    }

    include conf.d/*.conf;
}

2, 包含其他文件

[root@10-110-157-48 conf.d]# cat idfa.conf
server {
    listen     80 backlog=20480;
    server_name  10.110.157.48;
    add_header Cache-Control "no-cache,max-age=0";
    if_modified_since  off;
    access_log  off;

    userid      on;
    userid_name   uid;
    userid_path   /;

    location ^~ /idfa/ {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
        proxy_pass http://idfa_server;

    }
}

3, 启动方式

nginx -c /etc/nginx-idfa/nginx.conf

 4. 另一个配置样例

upstream nacos_server {
    server 127.0.0.1:18182;
}
server {
    listen 443 ssl http2 default_server;
    #listen [::]:443 ssl http2 default_server;
    ssl_certificate /home/wenbronk/nginx/conf.crt/live/v2.wenbronk.cn/fullchain.pem;     #生成的密钥对 #你的ssl证书, 如果第一次,可能还需要自签一下
    ssl_certificate_key /home/wenbronk/nginx/conf.crt/live/v2.wenbronk.cn/privkey.pem;   #生成的密钥对, 你的ssl key

    server_name nacos.wenbronk.cn;

    ssl_protocols   TLSv1 TLSv1.1 TLSv1.2; #使用的协议
    #issl_prefer_server_ciphers on;
    #ssl_ciphers               "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH EDH+aRSA !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4";  #使用的加密算法
    ssl_ciphers HIGH:!aNULL:!MD5;

    root /home/wenbronk/tengine/tengine/html;
    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html;

    location /bronk {
        proxy_redirect off;
        proxy_pass http://nacos_server;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
    }
}

 

posted @ 2019-11-22 10:13  bronk  阅读(1463)  评论(0编辑  收藏  举报