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

    nginx.conf配置文件详解

    # 代表权限
    #user  nobody;
    # user root;
    
    # 工作进程
    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 {
        # 支持的文件类型
        include       mime.types;
        
        # 流
        default_type  application/octet-stream;
    
        #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
        #                  '$status $body_bytes_sent "$http_referer" '
        #                  '"$http_user_agent" "$http_x_forwarded_for"';
    
        #access_log  logs/access.log  main;
    
        sendfile        on;
        #tcp_nopush     on;
    
        #keepalive_timeout  0;
        keepalive_timeout  65;
    
        #gzip  on;
        
        # 代表服务配置
        server {
            listen       80;        #端口配置
            server_name  localhost;     #服务名称
    
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
            
            # 当用户访问http://ip:80/
            location / {
                root   html;    #当匹配到/这个规则时指向nginx目录里的/html文件夹
                index  index.html index.htm;    #当访问不指定具体页面时默认显示的页面
            }
    
            #error_page  404              /404.html;
    
            # redirect server error pages to the static page /50x.html
            #
            error_page   500 502 503 504  /50x.html;
            
            # 当服务器出现500错误时访问的页面
            location = /50x.html {
                root   html;
            }
    
            # proxy the PHP scripts to Apache listening on 127.0.0.1:80
            #
            #location ~ .php$ {
            #    proxy_pass   http://127.0.0.1;
            #}
    
            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            #
            #location ~ .php$ {
            #    root           html;
            #    fastcgi_pass   127.0.0.1:9000;
            #    fastcgi_index  index.php;
            #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            #    include        fastcgi_params;
            #}
    
            # deny access to .htaccess files, if Apache's document root
            # concurs with nginx's one
            #
            #location ~ /.ht {
            #    deny  all;
            #}
        }
    
    
        # another virtual host using mix of IP-, name-, and port-based configuration
        #
        #server {
        #    listen       8000;
        #    listen       somename:8080;
        #    server_name  somename  alias  another.alias;
    
        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}
    
    
        # HTTPS server
        #
        #server {
        #    listen       443 ssl;
        #    server_name  localhost;
    
        #    ssl_certificate      cert.pem;
        #    ssl_certificate_key  cert.key;
    
        #    ssl_session_cache    shared:SSL:1m;
        #    ssl_session_timeout  5m;
    
        #    ssl_ciphers  HIGH:!aNULL:!MD5;
        #    ssl_prefer_server_ciphers  on;
    
        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}
    
    }
    
  • 相关阅读:
    Java集合类初始容量、加载因子、扩容增量
    并发之原子性、可见性、有序性
    多线程面试题
    MySQL引擎及选择
    SHA和MD5的Salt
    基于SSM的单点登陆05
    基于SSM的单点登陆04
    基于SSM的单点登陆03
    基于SSM的单点登陆02
    基于SSM的单点登陆01
  • 原文地址:https://www.cnblogs.com/nanhuaqiushui/p/12328254.html
Copyright © 2011-2022 走看看