• Nginx 配置文件


    #user  nobody;
    
    ### 工作进程数,可以根据 CPU 核心数量来配置
    worker_processes  1;
    
    ### 错误日志文件位置
    #error_log  logs/error.log;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;
    
    ### pid 文件,即 nginx 的进程号保存在这个文件里
    #pid        logs/nginx.pid;
    
    ### 工作模式
    events {
        ### 每个进程最大处理连接数
        worker_connections  1024;
    }
    
    ### http 配置
    http {
        ### 支持的媒体类型(html、css、js、pdf...)
        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 函数来输出文件
        sendfile        on;
        #tcp_nopush     on;
    
        ### 连接超时时间,超过就断开(大文件要特殊处理)
        #keepalive_timeout  0;
        keepalive_timeout  65;
    
        ### 开启 gzip 压缩
        #gzip  on;
    
        ### 配置虚拟主机,可以定义多个,一个 server 配置就代表一个虚拟主机
        server {
            ### 监听的端口
            listen       80;
            ### 服务器域名,没有域名就是 IP
            server_name  localhost;
    
            ### 网页编码
            #charset koi8-r;
    
            ### 访问该虚拟主机日志位置
            #access_log  logs/host.access.log  main;
    
            ### 根目录配置
            location / {
                ### 网站根目录配置,这里因为是 nginx 默认的首页就是 html/index.html,以后再开发时要改成项目的根目录
                root   html;
                ### 网站默认访问的页面
                index  index.html index.htm;
            }
    
            ### 如果程序返回 404 ,返回 404.html 页面
            #error_page  404              /404.html;
    
            # redirect server error pages to the static page /50x.html
            #
            ### 如果程序返回 500、502、503、504 就跳转到 50x.html 页面
            error_page   500 502 503 504  /50x.html;
            ### 错误页面位置配置
            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;
        #    }
        #}
    
    }
  • 相关阅读:
    判断以下字符串中出现次数最多的字符,并且算出该字符出现的次数
    status的状态码
    call和apply的区别?
    闭包
    $(document).ready和window. onload的区别
    python_pandas常用操作
    python经典例题
    爬B站并保存成csv文件。提供数据
    data_analysis:初识numpy
    01爬取豆瓣网电影数据进行numpy的练习
  • 原文地址:https://www.cnblogs.com/huanggy/p/9513347.html
Copyright © 2020-2023  润新知