提交,新增Vim文档

This commit is contained in:
YUN-PC5\user 2023-09-21 21:14:07 +08:00
parent b25eeaaa54
commit d2a105cc3c
3 changed files with 390 additions and 26 deletions

View File

@ -137,6 +137,351 @@ docker images
docker run --name xiaodaerp/netcore -p 7274:80 -d xiaodaerp/netcore
```
# 部署到 IIS
## IIS 介绍
Internet Information Services (IIS) 是一种灵活、安全且可管理的 Web 服务器,用于托管 Web 应用(包括 ASP.NET Core
## IIS 配置并安装
1. 打开控制面板 => 程序 => 启动或关闭Windows功能
![img](https://pic3.zhimg.com/80/v2-5be634b54f51cdee564f00e6dd4589d2_720w.webp)![img](https://pic1.zhimg.com/80/v2-78040e47692be8c8d36e94e059424c68_720w.webp)
2. 选择Internet Information Services 安装 IIS
> 注意:无需选中"设置"下的所有Internet Information Services按照自己的需要选择安装即可
![img](https://pic1.zhimg.com/80/v2-110ad0b9bc25c1b4614a81d5b69aba6c_720w.webp)
第一次安装时间比较久,耐心等待一会。
![img](https://pic3.zhimg.com/80/v2-e296862b914f6063b0fc7e7c169e992a_720w.webp)
![img](https://pic3.zhimg.com/80/v2-cdf21244638a844735d98ebfcc15fb26_720w.webp)
可能需要重启。
3. 验证 IIS 是否安装配置成功
找到Windows管理工具 => 打开IIS
![img](https://pic1.zhimg.com/80/v2-c0c190c1555e95119854ab5f62db1564_720w.webp)运行 IIS 默认的 Default Web Site 查看是否正常
> **在C:\inetpub\wwwroot下IIS默认绑定了一个80端口的静态页面站点我们将该站点浏览起来查看页面效果是否正常。**
> **站点地址http://localhost:80**
![img](https://pic2.zhimg.com/80/v2-8a60e11f83611629c9840c97401de119_720w.webp)
![img](https://pic1.zhimg.com/80/v2-ac97c2f542c12f1acb69ade08badfd08_720w.webp)
![image-20230921092026202](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20230921092026202.png)
访问成功
## 安装 ASP.Net Core 模块/托管捆绑包
使用以下链接下载最新安装程序:
[当前 .NET Core 托管捆绑包安装程序(直接下载)](https://dotnet.microsoft.com/permalink/dotnetcore-current-windows-runtime-bundle-installer)
## 重新启动 IIS
安装托管捆绑包后,可能需要手动重新启动 IIS。 例如,在运行 IIS 工作进程的路径上可能不存在 `dotnet` CLI 工具(命令)。
若要手动重启 IIS请停止 Windows 进程激活服务 (WAS),然后重新启动 World Wide Web 发布服务 (W3SVC) 和所有相关服务。 在高级命令 shell 中执行以下命令:
```powershell
net stop was /y
net start w3svc
```
安装完成后打开如下页面打开IIS管理器
选择左侧数的根目录后,在右侧选择模块,如下图所示。
![image-20230921092737808](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20230921092737808.png)
安装完成后在模块中会显示`AspNetCoreModuleV2`模块
![image-20230921092956235](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20230921092956235.png)
## 添加网站
网站=>右键添加网站
![image-20230921093121380](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20230921093121380.png)
![image-20230921093331155](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20230921093331155.png)
在上图中,我们创建了一个网站名为:**RDICoreWeb50**,并指定了到我们网站的发布路径。
这儿最重要的一步就是要设置网站的“应用程序池”。
在IIS左侧选择“应用程序池”在右则可以看到我们网站使用的“**RDICoreWeb50**”,双击打开,并做如图配置:
![image-20230921093515596](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20230921093515596.png)
## 报错解决
**请求筛选模块被配置为拒绝包含的查询字符串过长的请求**
ASP中配置行为 => 限制属性 => `最大请求实体主体限制` 1073741824
![image-20230921131734045](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20230921131734045.png)
配置编辑器中选择节 => system.webServer/serverRuntime
![image-20230921131850345](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20230921131850345.png)
配置`maxRequestEntityAllowed``uploadReadAheadSize` 1073741824
![image-20230921131933569](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20230921131933569.png)
项目目录`web.config`配置
```xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\ZR.Admin.WebApi.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxQueryString="2097151" maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
```
# 托管到 Nginx
## 配置
```conf
#user nobody;
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;
# map $http_upgrade $connection_upgrade {
# default upgrade;
# '' close;
# }
map $http_connection $connection_upgrade {
"~*Upgrade" $http_connection;
default keep-alive;
}
server {
listen 7779;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
#location / {
# root html;
# index index.html index.htm;
#}
root html/dist;
index index.html index.htm;
# 根请求会指向的页面
location / {
# 此处的 @router 实际上是引用下面的转发,否则在 Vue 路由刷新时可能会抛出 404
try_files $uri $uri/ @router;
# 请求指向的首页
index index.html;
}
location @router {
rewrite ^.*$ /index.html last;
}
#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;
#}
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_set_header Cookie $http_cookie;
proxy_pass http://127.0.0.1:50;
proxy_redirect off;
proxy_set_header HTTP-X-REQUESTED-WITH $http_x_requested_with;
proxy_set_header HTTP_X_REQUESTED_WITH $http_x_requested_with;
proxy_set_header x-requested-with $http_x_requested_with;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 128k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
rewrite ^/prod-api/(.*) /$1 break;
}
location /msghub {
proxy_pass http://127.0.0.1:50/msgHub;
# Configuration for WebSockets
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_cache off;
# WebSockets were implemented after http/1.0
proxy_http_version 1.1;
# Configuration for ServerSentEvents
proxy_buffering off;
# Configuration for LongPolling or if your KeepAliveInterval is longer than 60 seconds
proxy_read_timeout 100s;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# 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;
# }
#}
}
```
其中有两个map块
1. 第一个`map`块:
```conf
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
```
- 如果`$http_upgrade`的值与`default`不匹配(通常是指`$http_upgrade`未设置或未匹配任何其他条件),则将`$connection_upgrade`设置为`upgrade`
- 如果`$http_upgrade`的值为空字符串(''),则将`$connection_upgrade`设置为`close`。这意味着Nginx将关闭连接而不是升级。
2. 第二个`map`块(微软官方用法):
```conf
map $http_connection $connection_upgrade {
"~*Upgrade" $http_connection;
default keep-alive;
}
```
- 如果`$http_connection`的值匹配正则表达式`~*Upgrade`(不区分大小写地匹配包含"Upgrade"的值),则将`$connection_upgrade`设置为`$http_connection`的值,通常是`upgrade`
- 如果没有匹配的值,将`$connection_upgrade`设置为`keep-alive`。这意味着Nginx将保持HTTP连接保持活动状态以进行进一步的请求和响应。
总的来说,这两个`map`块都涉及控制HTTP升级的行为但它们使用不同的条件来决定何时将`$connection_upgrade`设置为`upgrade``close`。第一个`map`块根据`$http_upgrade`的值设置,而第二个`map`块根据`$http_connection`的值设置,通过正则表达式检查是否包含"Upgrade"。
# 顶级语句配置 `Program.cs`
## 取消默认JSON首字母小写命名

View File

@ -4,11 +4,9 @@ date: 2022-12-06 22:18:31
author: 文永达
top_img: https://gcore.jsdelivr.net/gh/volantis-x/cdn-wallpaper/abstract/67239FBB-E15D-4F4F-8EE8-0F1C9F3C4E7C.jpeg
---
# Redis
---
## 安装Redis
# 安装Redis
下载解压后
@ -31,7 +29,7 @@ make MALLOC=libc
make install PREFIX=/usr/redis
```
## Redis配置
# Redis配置
复制解压后的安装程序文件夹里的redis.conf
@ -54,9 +52,9 @@ port 6379
修改端口号port
## Redis指令
# Redis指令
### key操作指令
## key操作指令
1. set: 设置key-value
@ -86,9 +84,9 @@ port 6379
14. type: 查看key对应的数据类型
### Redis数据类型
## Redis数据类型
#### string类型
### string类型
1. mset: 一次设置多个key-value
2. mget: 一次获取多个key-value
3. getset: 获得原始的key的值同时设置新值如果不存在key则新建一个key
@ -96,11 +94,11 @@ port 6379
5. append: 为对应的key的value追加内容
6. getrange: 字符串截取
#### List类型
### List类型
相当于Java中的List集合
特点:有序(添加的先后顺序),可以重复
> 相当于Java中的List集合
>
> 特点:有序(添加的先后顺序),可以重复
1. lpush: 将某个值加入到一个list列表将这个元素添加到列表的头部
2. lrange获取某一个下标区间内的元素
@ -116,11 +114,11 @@ port 6379
12. ltrim保留列表中特定区间内的元素。列表的截取
13. linsert在某一个元素之前或者之后插入元素
#### Set类型
### Set类型
相当于Java中的set集合
特点:无序,不可以重复,若重复,则会覆盖
> 相当于Java中的set集合
>
> 特点:无序,不可以重复,若重复,则会覆盖
1. sadd为集合添加元素
2. smembers显示集合中的所有元素。无序添加的先后顺序
@ -135,11 +133,11 @@ port 6379
11. sunion求并集
#### Zset类型
### Zset类型
相当于Java中的TreeSet集合
特点:不可以重复,但有序
> 相当于Java中的TreeSet集合
>
> 特点:不可以重复,但有序
1. zadd添加一个有序集合添加元素时需要指定每一个元素的分数
2. zcard返回集合中元素的个数
@ -152,11 +150,11 @@ port 6379
9. zrem移除某一个元素
10. zincrby给某一个元素加分
#### Hash类型
### Hash类型
相当于Java中的Map集合
特点key不可重复value可重复。无序
> 相当于Java中的Map集合
>
> 特点key不可重复value可重复。无序
1. hset设置一个key/value对
2. hget获取一个key对应的value
@ -191,8 +189,6 @@ vim redis.conf
bind 0.0.0.0 #修改bind为0.0.0.0 让其可被外界访问
```
修改 slave1和slave2 redis.conf内容
```shell
@ -236,5 +232,7 @@ cp /root/sentinel/sentinel.conf /usr/redis/bin
./redis-sentinel sentinel.conf
```
## Redis缓存穿透
> 缓存穿透指的查询缓存和数据库中都不存在的数据,这样每次请求直接打到数据库,就好像缓存不存在一样。

21
source/_posts/Vim.md Normal file
View File

@ -0,0 +1,21 @@
---
title: Vim
date: 2023-09-21 15:00:20
tags:
---
# Vim 的工作模式
vim 有6种工作模式。
- 普通模式:使用 vim 打开一个文件时默认模式。也叫命令模式,运行用户通过各种命令浏览代码、滚屏等操作。
- 插入模式也可以叫做编辑模式在普通模式下敲击i、a 或 o 就进入插入模式,允许用户通过键盘输入、编辑。
- 命令行模式:在普通模式下,先输入冒号`:`,接着输入命令 ,就可以通过配置命令对 vim 进行配置了,如改变颜色主题、显示行号等,这些配置命令也可以保存到/etc/vim/vimrc配置文件中每次打开默认配置执行。
- 可视化模式:在普通模式下敲击键盘上的 v 键,就进入可视化模式,然后移动光标就可以选中一块文本,常用来完成文本的复制、粘贴、删除等操作。
- 替换模式:如果我们想修改某个字符,不需要先进入插入模式,删除,然后再输入新的字符,直接在普通模式下,敲击`R`键就可以直接替换。
- EX模式类似于命令行模式可以一次运行多个命令。
vim 的各种工作模式可以通过不同的键进行切换,用户统一使用`ESC`键返回到普通模式。
# 光标移动命令