停止Nginx服务的四种方法

  • 从容停止服务(这种方法较stop相比就比较温和一些了,需要进程完成当前工作后再停止)
    nginx -s quit
  • 立即停止服务(这种方法比较强硬,无论进程是否在工作,都直接停止进程)
    nginx -s stop
  • systemctl 停止(systemctl属于Linux命令)
    systemctl stop nginx.service
  • killall 方法杀死进程(直接杀死进程,在上面无效的情况下使用,态度强硬,简单粗暴)
    killall nginx

启动Nginx

  • nginx直接启动
    start nginx
  • systemctl命令启动
    systemctl start nginx.service
  • 查看启动后记录
    ps aux | grep nginx

重启Nginx服务

  • systemctl命令重启
    systemctl restart nginx.service
  • 重新载入配置文件(当有系统配置文件有修改,用此命令,建议不要停止再重启,以防报错!)
    nginx -s reload

查看端口号

  • Linux系统
    netstat -tunpl
  • window系统
    netstat -ano

Linux 执行shell 执行npm的权限问题

linux下遇到权限问题请执行: npm i --unsafe -perm

node升级

清除npm缓存,执行命令

npm cache clean -f

n模块是专门用来管理nodejs的版本,安装n模块

npm install -g n

更新升级node版本

 n stable // 把当前系统的 Node 更新成最新的 “稳定版本”
 n lts // 长期支持版
 n latest // 最新版
 n 10.14.2 // 指定安装版本

查看升级后的node版本

node -v

mac系统中vscode有更新权限

sudo chown $USER ~/Library/Caches/com.microsoft.VSCode.ShipIt/

安装mcrypt扩展(mac中使用brew安装的php环境)

wget  http://pecl.php.net/get/mcrypt-1.0.3.tgz
tar xf mcrypt-1.0.1.tgz
cd mcrypt-1.0.3
/usr/local/opt/php/bin/phpize
./configure --with-php-config=/usr/local/opt/php/bin/php-config
make && make install

加入php.ini配置中

在编译的文件夹中找到./modules/mcrypt.so
vim php.ini或者 在php根目录下的conf.d中新建文件
extension=mcrypt.so

目的

1、实现对单个状态进行监控
2、多个组件的状态共享
3、异步处理业务逻辑

使用的类库说明

1、为了实现多个组件的状态共享, 可以使用react1.6.8之后的hooks中提供的Provider或者redux
2、为了实现业务异步处理,并且数据的操作与组件业务逻辑分离。

1) 无法使用react1.6.8提供的hooks,虽然hooks在业务与数据混合的时候可以实现异步,但是在业务与数据分离的情况下,hooks是有心无力的。
2) 使用redux的时候,有一个中间件 redux-thunk,可以进行在数据层异步处理

3、为了实现状态监控

1) 使用redux中subscribe进行监控,但是这是监控所有state变化的,颗粒太大了,如果需要监听一个值,那么需要层层对比。
2) 使用react1.6.8之后的useEffect,可以对单个状态进行改变

4、为了与react进行结合使用,需要使用到react-redux
5、使用react中的hooks模式,需要使用的函数式声明,而不能使用class式声明

方案决定

1、使用redux + react-redux + redux-thunk + react中的hooks特性进行整合
2、整合的重点在于,在监听对组件中,不能使用class声明,必须使用函数式声明
3、为了使用redux,也就是说,有一定程度上,抛弃了react中hooks的一些特性,比如: useReducer、useContext等

系统

修改电脑名字(wkj电脑名字)

方法1: hostnamectl set-hostname wkj
方法2: vi /etc/hostname
临时修改: hostname wkj

安装系统之后网络没有

在/etc/sysconfing/network-scripts/ifcfg-ens33中修改网卡自动重启

ONBOOT=yes

无法使用ifconfig命令

yum install net-tools

安装rar解压工具

新建repo包:vi /etc/yum.repos.d/dag.repo

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1
gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

重启yum源: yum-config-manager --enable nginx-mainline
yum源错误跳过: yum-config-manager --save --setopt=dag.skip_if_unavailable=true

nginx配置

配置nginx上传文件限制

新建一个配置用于存放文件限制
[root@wkjhost ~]# vi /etc/nginx/conf.d/file.conf

server_tokens on;
#优化服务器域名的散列表大小 
server_names_hash_bucket_size 64;
server_names_hash_max_size 2048;
sendfile on;#开启高效文件传输模式
tcp_nopush on;#减少网络报文段数量
tcp_nodelay on;#提高I/O性能
keepalive_timeout 600;#连接超时时间定义
client_header_timeout 600;#读取客户端请求头数据的超时时间
client_body_timeout 600;#读取客户端请求主体的超时时间
send_timeout 600;#响应客户端的超时时间
client_max_body_size 100m;#上传文件的大小限制