应用运维文档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工具

相关推荐

  1. 应用维文1

    2024-04-08 06:32:02       36 阅读
  2. 维文本三剑客详辨

    2024-04-08 06:32:02       47 阅读
  3. 维系列Nginx:设置黑/白名单IP限制

    2024-04-08 06:32:02       63 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-08 06:32:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-08 06:32:02       101 阅读
  3. 在Django里面运行非项目文件

    2024-04-08 06:32:02       82 阅读
  4. Python语言-面向对象

    2024-04-08 06:32:02       91 阅读

热门阅读

  1. 汇编基础-----常见命令基本使用

    2024-04-08 06:32:02       37 阅读
  2. python 标准库之 xml.etree.ElementTree

    2024-04-08 06:32:02       26 阅读
  3. 机器学习---集成学习(未完成)

    2024-04-08 06:32:02       35 阅读
  4. node.js常用指令

    2024-04-08 06:32:02       30 阅读
  5. Node.js 常用命令及其详细用法

    2024-04-08 06:32:02       41 阅读
  6. 单片机学习day4

    2024-04-08 06:32:02       30 阅读