前端相关🔥

2023/9/26 nodenpmvue前端

npm配置

由于npm的registry地址是国外的,速度很慢,所以推荐使用淘宝镜像:https://registry.npm.taobao.org

临时配置:npm --registry https://registry.npm.taobao.org install <Module Name>

永久配置:npm config set registry https://registry.npm.taobao.org

恢复原来地址:npm config set registry https://registry.npmjs.org

使用cnpm:npm install -g cnpm --registry=https://registry.npm.taobao.org

使用时用cnpm代替npm:如cnpm install <Module Name>

设置代理:npm config set proxy=http://xx.xx.xx.xx:8888

禁用ssl证书:npm set strict-ssl false
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

nginx部署配置

location /auth/ {
    proxy_pass http://xx.xx.xx.xx:8001;
    proxy_set_header Host $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;
}

location /auto_api/ {
    proxy_pass http://xx.xx.xx.xx:8002;
    proxy_set_header Host $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;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

nginx负载均衡

upstream backend {
    server xx.xx.xx.xx:8001;
    server xx.xx.xx.xx:8002;
    server xx.xx.xx.xx:8003;
}

server {
    listen 80;
    server_name localhost;

    location / {
        proxy_pass http://backend;
        proxy_set_header Host $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;
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
    等一分钟 Wait One Minute
    徐誉滕