Blazor
部署到linux
使用nginx直接部署,配置如下:
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; # 关注点1
server {
listen 8123;
listen [::]:8123;
server_name xiaochengxu.aiencare.com;
#access_log /var/log/nginx/host.access.log main;
location / {
root /etc/nginx/other.d/webs/aiencarers-blazor;
try_files $uri $uri/ /index.html =404;
limit_req zone=one burst=360 nodelay; # 关注点1
#index index.html index.htm;
include /etc/nginx/mime.types; # 关注点2
types {
application/wasm wasm; # 关注点2
}
default_type application/octet-stream; # 关注点3
location /_framework/ {
gzip_static on; # 关注点3
}
}
#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 /usr/share/nginx/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;
#}
}
关注点1:
必须配置,当blazor打开的时候,同一时间会有大量的请求,可能会被就拒绝,出现503,通过设置这个,就可以解决。
burst=360,刚开始设置为60,结果不行,所以设置成360后正常
关注点2:
说是需要支持blazor的mime type,我这边只是依样画葫芦,会不会出错不知道
关注点3:
压缩的选项,可以尝试下
关于图片地址无法打开
现象:文件在,但是文件地址无法访问
解决:linunx对大小写敏感,如Logo.jpg,需要改为logo.jpg