mysql配置文件

[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
# 设置3306端口
port = 3308
# 设置mysql的安装目录
basedir = D:/service/mysql
# 设置mysql数据库的数据的存放目录
datadir = D:/service/mysql/data
# 允许最大连接数
max_connections=20
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 创建模式
sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

worker_processes  auto;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    
    sendfile        on;
    tcp_nopush      on;
    tcp_nodelay     on;

    keepalive_timeout  20;
    client_max_body_size 50M;

    # Enable gzip compression for performance
    gzip on;
    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_vary on;

    server {
        listen       1888;
        server_name  localhost;
        charset utf-8;
        client_max_body_size 50M;

        location / {
            root   D:/service/project/backend_web;
            try_files $uri $uri/ /index.html;
            index  index.html index.htm;
        }
        
        location /prod-api/ {
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header REMOTE-HOST $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://localhost:8000/;
            client_max_body_size 50M;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

<configuration>
  <system.webServer>
    <handlers>
      <add name="Python FastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Python39\python.exe|C:\Python39\Lib\site-packages\wfastcgi.py" resourceType="Unspecified" />
    </handlers>
    <fastCgi>
      <application fullPath="C:\Python39\python.exe" arguments="C:\Python39\Lib\site-packages\wfastcgi.py" />
    </fastCgi>
  </system.webServer>
</configuration>
worker_processes  auto;

events {
    worker_connections  4096;  # 增加并发连接数
    multi_accept on;  # worker 进程一次接收多个连接
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    
    sendfile        on;
    tcp_nopush      on;
    tcp_nodelay     on;

    keepalive_timeout  15;  # 进一步减少 keepalive 超时时间
    keepalive_requests 1000;  # 每个连接最多允许 1000 个请求
    client_max_body_size 50M;

    # 启用 gzip 压缩
    gzip on;
    gzip_disable "msie6";
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;  # 压缩级别,平衡 CPU 和压缩比
    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 application/x-font-ttf font/opentype image/svg+xml image/x-icon;

    # 启用缓存,优化静态文件传输
    open_file_cache max=1000 inactive=20s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 2;
    open_file_cache_errors on;

    server {
        listen       1888;
        server_name  localhost;
        charset utf-8;
        client_max_body_size 50M;

        location / {
            root   D:/service/project/backend_web;
            try_files $uri $uri/ /index.html;
            index  index.html index.htm;
        }
        
        location /prod-api/ {
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header REMOTE-HOST $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://localhost:8000/;
            client_max_body_size 50M;
        }

        # 配置浏览器缓存静态文件
        location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
            expires 30d;
            add_header Cache-Control "public";
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}
@echo on

cd /d "D:\Desktop\asd\python-finance-expense-web\backend"

call conda activate backend

waitress-serve --host=0.0.0.0 --port=8000 application.wsgi:application

pause
posted @ 2024-10-24 13:50  李东阳  阅读(44)  评论(0编辑  收藏  举报