zoukankan      html  css  js  c++  java
  • nginx 配置文件理解

    nginx 配置文件理解

    # 设置nginx服务的系统使用用户
    user www-data;
    
    # 工作进程数量
    worker_processes auto;
    
    # 工作进程id
    pid /run/nginx.pid;
    
    #nginx 错误日志
    # error_log 目录 错误级别;
    # access_log 目录 [log_format name];
    
    # log_format 配置在http 中 按照信息的固定格式输出日志 
    
    # 事件循环
    events {
    		# 每个进程最大连接数 
            worker_connections 768;
            
            # multi_accept on;
            
            
            # 工作进程数量
            # use
    }
    
    http {
            ##
            # Basic Settings
            ##
    
            sendfile on;
            tcp_nopush on;
            tcp_nodelay on;
            keepalive_timeout 65;
            types_hash_max_size 2048;
            # server_tokens off;
    
            # 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 /var/log/nginx/access.log;
            error_log /var/log/nginx/error.log;
    
            ##
            # Gzip Settings
            ##
    
            gzip on;
            gzip_disable "msie6";
                                           
            # 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/*;
            
            server {
            	# 监听端口
                listen       80;
                
                # 主机域名或ip地址
                server_name    localhost;
                
                # 配置默认访问路径
                location / {
                    root /usr/share/nginx/html;
                    
                    index  index.html index.htm;
                }
                
                # 错误页面
                error_page 500 502 503 504 /50x.html
                location = /50x.html {
                    root  /usr/share/nginx/html
                }
            }
            
            server {
                ...
            }
    }
    
    
    #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;
    #       }
    #}
    

    nginx 测试配置文件 nginx -tc 【配置文件的路径】

  • 相关阅读:
    web--webstorm的一些常用快捷键
    studio--常见设置
    并发之lock的condition接口
    并发之atomic实例
    并发之volatile底层原理
    并发之java.util.concurrent.atomic原子操作类包
    多线程之整体概括
    Sqlite之事务
    activity--生命周期总结
    网络之TCP握手总结
  • 原文地址:https://www.cnblogs.com/sha-ka/p/12779194.html
Copyright © 2011-2022 走看看