zoukankan      html  css  js  c++  java
  • 贴两个nginx完整配置

    nginx.conf # 主文件  在 /etc/nginx/nginx.conf

    user www-data;
    worker_processes auto;
    pid /run/nginx.pid;
    include /etc/nginx/modules-enabled/*.conf;
    
    events {
        worker_connections 768;
        # multi_accept on;
    }
    
    http {
    
        ##
        # Basic Settings
        ##
        log_format main '$remote_addr - $remote_user [$time_local] "$request"'
                '$status $body_bytes_sent "$http_referer"'
                '"$http_user_agent" "$http_x_forwarded_for"';
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # server_tokens off;
        client_max_body_size 30m;
        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;
    
        include /etc/nginx/mime.types;
        default_type application/octet-stream;
    
        ##
        # SSL Settings
        ##
    
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;
    
        ##
        # Logging Settings
        ##
    
        access_log /www/wwwlogs/access.log main;
        error_log /www/wwwlogs/nginx_error.log;
    
        ##
        # Gzip Settings
        ##
    
        gzip on;
    
        # gzip_vary on;
        # gzip_proxied any;
        # gzip_comp_level 6;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
    
        ##
        # Virtual Host Configs
        ##
    
        include /etc/nginx/conf.d/*.conf;
           #include /etc/nginx/sites-enabled/*;
        include /etc/nginx/myconfig/*.conf;
    }
    
    
    #mail {
    #    # See sample authentication script at:
    #    # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
    # 
    #    # auth_http localhost/auth.php;
    #    # pop3_capabilities "TOP" "USER";
    #    # imap_capabilities "IMAP4rev1" "UIDPLUS";
    # 
    #    server {
    #        listen     localhost:110;
    #        protocol   pop3;
    #        proxy      on;
    #    }
    # 
    #    server {
    #        listen     localhost:143;
    #        protocol   imap;
    #        proxy      on;
    #    }
    #}

    dash.conf  # 后台界面

    server
    {
        listen 80;
        listen 443 ssl http2;
        server_name 域名;
        root /www/wwwroot/default/layuiadmin;
    
        index page/login-3.html;
            
        #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
        #error_page 404/404.html;
        #limit_conn perserver 300;
        #limit_conn perip 25;
        limit_rate 50240k;
        #HTTP_TO_HTTPS_START
        if ($server_port !~ 443){
            rewrite ^(/.*)$ https://$host$1 permanent;
        }
        #HTTP_TO_HTTPS_END
        ssl_certificate    /etc/nginx/sslkey/ssl.pem;
        ssl_certificate_key    /etc/nginx/sslkey/ssl.key;
        ssl_protocols  TLSv1.1 TLSv1.2;
        ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;
        ssl_session_timeout 10m;
        add_header Strict-Transport-Security "max-age=31536000";
        error_page 497  https://$host$request_uri;
    
        #SSL-END
        
        #ERROR-PAGE-START  错误页配置,可以注释、删除或修改
        #error_page 404 /404.html;
        #error_page 502 /502.html;
        #ERROR-PAGE-END
        
        #PHP-INFO-START  PHP引用配置,可以注释或修改
        
        
        #禁止访问的文件或目录
        #location ~ ^/(.user.ini|.htaccess|.git|.svn|.project|LICENSE|README.md)
        #{
        #    return 404;
        #}
        
        #一键申请SSL证书验证目录相关设置
        #location ~ .well-known{
        #    allow all;
        #}
        
        #location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
        #{
        #    expires      30d;
        #    error_log /dev/null;
        #    access_log off;
        #}
        
        #location ~ .*.(js|css)?$
        #{
        #    expires      12h;
         #   error_log /dev/null;
          #  access_log off; 
        #}
        #access_log logs/dash.im.izdax.cn.log;
        #error_log  logs/dash.im.izdax.cn.error.log;
    }

    dashAPI.config  # 后台接口配置

    server
    {
        listen 80;
        listen 443 ssl http2;
            server_name 域名;        
        location /{
            proxy_pass http://127.0.0.1:5558;
            proxy_redirect off;
            proxy_set_header   Host                 $http_host;
            proxy_set_header   X-Real-IP            $remote_addr;
            proxy_set_header   X-Forwarded-For      $proxy_add_x_forwarded_for;
            proxy_set_header   X-Forwarded-Proto    $scheme;
        }
    
        #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
        #error_page 404/404.html;
        #limit_conn perserver 300;
        #limit_conn perip 25;
        limit_rate 50240k;
        #HTTP_TO_HTTPS_START
        if ($server_port !~ 443){
            rewrite ^(/.*)$ https://$host$1 permanent;
        }
        #HTTP_TO_HTTPS_END
        ssl_certificate    /etc/nginx/sslkey/ssl.pem;
        ssl_certificate_key    /etc/nginx/sslkey/ssl.key;
        ssl_protocols  TLSv1.1 TLSv1.2;
        ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;
        ssl_session_timeout 10m;
        add_header Strict-Transport-Security "max-age=31536000";
        error_page 497  https://$host$request_uri;
        access_log /www/wwwlogs/dashapi.im.izdax.cn.error.log main;
        error_log  /www/wwwlogs/dashapi.im.izdax.cn.access.log;
    }
  • 相关阅读:
    MYSQL的一些命令
    微信支付细节说明(服务商版本)
    MYSQL的一些概念
    MYSQL内置数据库之information_schema
    Lua5.1 三色标记gc
    LUA计算table大小getn
    游戏排行榜系统设计 -- 有感
    nginx如何跑起来
    C# winform datagridview数据绑定问题
    windows共享路径访问SMB安装
  • 原文地址:https://www.cnblogs.com/ShanCe/p/14343835.html
Copyright © 2011-2022 走看看