应用运维文档1

统一nginx接入配置指南

Nginx配置规范

1:不带微服务编码上下文至后端,以metadata-ui为例
location段配置信息,location配置中维护微服务编码上下文信息

# app_code: metadata-ui   流水线名称: metadata-ui
location  ~ ^/metadata-ui/(?P.*) {
    set $app_code 'metadata-ui';
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $http_host;
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    if ( $nginx-flag = "out-nginx"){
        set $nginx "public";
    }
    include crossDomain.conf;
    proxy_set_header x-network-type $yonyoubipnginx;
    proxy_set_header Host $target_ingress;
    proxy_pass http://$target_ingress/$URI$is_args$args;
}

# map信息 【非共享配置,各领域须适配自己所属领域的配置,并追加到此map文件中】
map $app_code $target_ingress {
# app_code: metadata-ui   流水线名称: metadata-ui
    'metadata-ui'  'pre-metadata-ui.k8s.com';
}

2:带微服务编码上下文至后端,以doc-material为例
location段配置信息,location配置中维护微服务编码上下文信息

# app_code: doc-material   流水线名称: pc-server
location  ~ ^/doc-material {
    set $app_code 'doc-material';
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $http_host;
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    if ( $nginx-flag = "out-nginx"){
        set $nginx "public";
    }
    include crossDomain.conf;
    proxy_set_header x-network-type $nginx;
    proxy_set_header Host $target_ingress;
    proxy_pass http://$target_ingress;
}
# map信息 
map $app_code $target_ingress {
# app_code: doc-material   流水线名称: pc-server
    'doc-material'  'doc-material.k8s.com';
}

添加nginx配置

1、create  master

GitLab 也宣布 使用"main"代替"master"作为新的默认分支名。所以后续新建项目即默认main分支了。

①在GitLab上新建项目test后,进入test项目,点击左侧Repository->Branches

可以看到里面只有一个受保护的默认分支main,此处无法删除。

然后新建分支master:点击右上角New branch,输入分支名字master,Create branch。

②再点击左侧Settings->Repository

点开Default branch,选择Default branch为master,Save Changes。

至此默认分支就是master了。

2、 
cd existing_repo
git init 
git remote add origin git@git.aliyun.com:devops/nginx.git
git add .
git commit -m "init"
git push -uf origin master

Linux系统挂载NAS文件系统
1、安装NFS客户端
如果您使用CentOS、Redhat、Aliyun Linux操作系统,请执行以下命令
sudo yum install nfs-utils
如果您使用Ubuntu或Debian操作系统,请执行以下命令
sudo apt-get update
sudo apt-get install nfs-common
2、增加同时发起的NFS请求的数量

if (lsmod | grep sunrpc); then
(modinfo sunrpc | grep tcp_max_slot_table_entries) && sysctl -w sunrpc.tcp_max_slot_table_entries=128
(modinfo sunrpc | grep tcp_slot_table_entries) && sysctl -w sunrpc.tcp_slot_table_entries=128
fi
(modinfo sunrpc | grep tcp_max_slot_table_entries) && echo "options sunrpc tcp_max_slot_table_entries=128" >> /etc/modprobe.d/alinas.conf
(modinfo sunrpc | grep tcp_slot_table_entries) && echo "options sunrpc tcp_slot_table_entries=128" >> /etc/modprobe.d/alinas.conf

3、创建目录
mkdir /middleware /docker /data/maven /systemlog /data/cloudproduct /var/yRelease
4、挂载NAS
sudo mount -t nfs -o vers=4,minorversion=0,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 1d5014af0d-dbu83.cn-beijing.nas.aliyuncs.com:/middleware /middleware
sudo mount -t nfs -o vers=4,minorversion=0,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 1d5014af0d-dbu83.cn-beijing.nas.aliyuncs.com:/docker /docker
sudo mount -t nfs -o vers=4,minorversion=0,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 1d5014af0d-dbu83.cn-beijing.nas.aliyuncs.com:/maven  /data/maven
sudo mount -t nfs -o vers=4,minorversion=0,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 1d5014af0d-dbu83.cn-beijing.nas.aliyuncs.com:/systemlog /systemlog
sudo mount -t nfs -o vers=3,noacl,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 01137036-1gqo.cn-beijing.extreme.nas.aliyuncs.com:/ /data/cloudproduct
sudo mount -t nfs -o vers=3,noacl,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 1d5014af0d-dbu83.cn-beijing.nas.aliyuncs.com:/ /var/yRelease

Linux内存管理神器:smem工具

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值