nginx-配置文件样例

Posted bronk

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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;
    }
}

 

以上是关于nginx-配置文件样例的主要内容,如果未能解决你的问题,请参考以下文章

nginx配置样例

nginx.conf 忽略了 nginx-ingress 配置映射片段

Nginx配置文件详细介绍

Nginx——Nginx启动报错Job for nginx.service failed because the control process exited with error code(代码片段

Nginx基础入门之相关配置模板样例参考

Nginx完整配置配置样例