随笔 - 1357  文章 - 0  评论 - 1104  阅读 - 1941万

nginx.conf文件说明

复制代码
#Nginx所有用户和组,window下不指定
#user  nobody;

#工作的子进程数量(通常等于CPU数量或者2倍于CPU)
worker_processes  1;

#错误日志存放路径
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#指定pid(进程id)存放文件
#pid        logs/nginx.pid;


#执行的事件
events {
    #允许最大连接数
    worker_connections  51200;
}


http {
    # MIME类型就是设定某种扩展名的文件用一种应用程序来打开的方式类型
    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通道
    #tcp_nopush     on;

    #活动时间
    #keepalive_timeout  0;
    keepalive_timeout  65;

    #打开gzip数据流压缩
    #gzip  on;

    #对于服务的配置
    server {
        #端口号(如果你本地安装了其他Web服务器,为了避免冲突,这里需要修改)
        listen       80;
        #服务名,本地或者www.abc.com *.abc.com
        server_name  localhost;
        #设置字符集
        #charset koi8-r;
        #打日志
        #access_log  logs/host.access.log  main; 

        location / {
            root   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;
        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;
    #    server_name  localhost;
    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
}
复制代码

 

posted on   Ruthless  阅读(1041)  评论(0编辑  收藏  举报
编辑推荐:
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 写一个简单的SQL生成工具
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
历史上的今天:
2011-05-13 六、把文件存放在SDCard
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示