73.docker中nginx+php

发表于 linux 分类,标签:
备注:提示filenotfind是因为要把php的index.php写入到php容器的/usr/share/nginx/www目录,而不是nginx里面。补充:主要注意两点,nginx配置文件指向,fastcgi_pass端口指向确定没问题就能同时解析php+html,然后重新加载配置文件servicenginxreload。使用docker快速搭建nginx+php环境测试环境:centos7.6,docker18.09.11.首先要确保docker环境已经安装成功[root@localhost~]# docker--versionDockerversion18.09.2,build62479622.docker安装nginx[root@localhost~]# dockerpullnginx[root@localhost~]# ...

72.tar排除目录打包

发表于 linux 分类,标签:
我们在Linux运维中,会经常使用到tar命令来进行对文件的备份打包压缩,有时候需要打包某个业务目录,但需要排除掉日志,怎么操作呢?1)打包时排除特定文件tar-Pczvf/usr/local/web.tar.gz/usr/local/web/*--exclude=/usr/local/web/catalina,log2)打包时排除特定类型文件tar-Pczvf/usr/local/web.tar.gz/usr/local/web/*--exclude=/usr/local/web/catalina.*tar-Pczvf/usr/local/web.tar.gz/usr/local/web/*--exclude=*.logtarzcvfnginx.tar.gz/opt/nginx/--exclude*.jpg--exclude .png--e...

71.harbor安装记录

发表于 linux 分类,标签:
系统要求:docker:17.06.0-ce以上版本docker-compose:1.18.0+以上版本1.安装docker-compostcurl-L"https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname-s)-$(uname-m)"-o/usr/local/bin/docker-compose2.修改文件权限chmod+x/usr/local/bin/docker-compose3.测试结果docker-compose--version1.安装hatborwgethttps://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-offline-installer-...

70.docker汇总

发表于 linux 分类,标签:
--------------------------------------------------------------------------------------------------1#备份imagesdocker save 98d8bb571885 > /root/rancher.tar--------------------------------------------------------------------------------------------------2#导入imagesdocker load -i /root/rancher.tar------------------------------------------------------...

69.python3替换python2

发表于 linux 分类,标签:
注意:需要root权限。查找python位置whereispython删除软链接rm/usr/bin/python查看环境变量echo$PATH  生成python3的软链接到环境变量ln-s/usr/bin/python3.6/usr/bin/python...

68.go环境配置

发表于 linux 分类,标签:
https://blog.csdn.net/bulucc/article/details/135611426go的安装及配置1、找到对应的版本包下载,例如wget https://golang.google.cn/dl/go1.21.6.linux-amd64.tar.gz2、下载完成后配置解压Go源码包tar -zxf go1.21.6.linux-amd64.tar.gz3、将解压的文件移动到安装目标路径sudo mv go /usr/local4. 配置Go的环境变量,可以通过编辑 ~/.profile 文件(或者 ~/.bashrc 文件)来实现#vim ~/.profilevim /etc/pro...

67.nginx动态跨域

发表于 linux 分类,标签:
#nginx屏蔽版本号server_tokens  off;#Cookie设置成HttpOnlyadd_header Set-Cookie "Path=/; HttpOnly; Secure";#防止XSS,下面3行add_header X-Frame-Options "SAMEORIGIN";add_header X-XSS-Protection "1; mode=block";add_header X-Content-Type-Options "nosniff";add_header Strict-Transport-Security&n...

66.gitlab配置

发表于 linux 分类,标签:
1.下载官方包:https://packages.gitlab.com/gitlab/gitlab-ce清华包:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/2.rpm安装:rpm -ivh gitlab-ce-13.6.1-ce.0.el7.x86_64.rpmyum install -y gitlab-ce-13.6.1-ce.0.el7.x86_64.rpm配置yam源方式安装:在/etc/yum.repos.d/下新建gitlab-ce.repo,写入如下内容:[gitlab-ce]name=gitlab-cebaseurl= Repo_gpgcheck=0Enabled=1Gpgkey=https://packages.gitl...

65.http转https

发表于 linux 分类,标签:
Nginx环境下强制http转https设置方法:方法一:下面代码照搬过去就行。无需做任何修改。春哥技术博客推荐此种方法,非常简单,改完以后实时生效,不用重启服务器。if($scheme=http){return301https://$host$request_uri;}方法二:下面代码照搬过去就行。无需做任何修改。if($server_port=80){return301https://$host$request_uri;}方法三:下列代码中请注意把域名修改成自己域名。if($ssl_protocol=""){return301https://$server_name$request_uri;}if($host!=www.kjcwh.com){return301$scheme://www.kjcwh.com$r...

64.nginx_waf

发表于 linux 分类,标签:
配置如下:##如果我是阿里的WAF,ALB,SLB后面,因为阿里已经弄好了$http_x_forwarded_for的第一个ip为客户端iplocation / {access_by_lua_file "/opt/verynginx/openresty/nginx/conf/lua/whiteKeykz18.lua";proxy_set_header xrequestid $xrequestid;proxy_headers_hash_max_size 51200;proxy_headers_hash_bucket_size 6400;proxy_set_header Host       $host...