nginx匹配规则脚本
这个是可乐在工作时候用到的脚本
嘻嘻 ~
有点low哈哈哈 ~
不许喷me~
会哭的 呜呜~
vim maching_nginx.sh
#!/bin/bash
#名字
name=znxd_cqjyxt_ah_bb
#portal路径
echo "#产权交易系统" > /etc/nginx/conf.d/${name}.conf
echo "#portal" >> /etc/nginx/conf.d/${name}.conf
echo "server{" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t listen 1001;" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t server_name 10.150.10.30;" >> /etc/nginx/conf.d/${name}.conf
echo "location /{" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t root /data/static_project/znxd_cqjyxt_ah_bb/portal/dist;" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t index index.html index.htm;" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t }" >> /etc/nginx/conf.d/${name}.conf
echo "location /api{" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t include ./conf.d/api_include.config;" >> /etc/nginx/conf.d/${name}.conf
echo -e "\tproxy_pass http://10.150.10.30:10001;" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t }" >> /etc/nginx/conf.d/${name}.conf
echo "location /upload{" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t root /data/docker_script/znxd_cqjyxt_ah_bb;" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t }" >> /etc/nginx/conf.d/${name}.conf
echo "}" >> /etc/nginx/conf.d/${name}.conf
#admin路径
echo "#admin" >> /etc/nginx/conf.d/${name}.conf
echo "server{" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t listen 1002;" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t server_name 10.150.10.30;" >> /etc/nginx/conf.d/${name}.conf
echo "location /{" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t root /data/static_project/znxd_cqjyxt_ah_bb/admin/dist;" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t index index.html index.htm;" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t }" >> /etc/nginx/conf.d/${name}.conf
echo "location /api{" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t include ./conf.d/api_include.config;" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t proxy_pass http://10.150.10.30:10001;" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t }" >> /etc/nginx/conf.d/${name}.conf
echo "location /upload{" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t root /data/docker_script/znxd_cqjyxt_ah_bb;" >> /etc/nginx/conf.d/${name}.conf
echo -e "\t }" >> /etc/nginx/conf.d/${name}.conf
echo "}" >> /etc/nginx/conf.d/${name}.conf
nginx -t
if [ $? -eq 0 ]; then
echo "宝贝 nginx没有问题鸭"
nginx -s reload
else
echo "宝贝 nginx出现问题了呢"
fi
bash maching_nginx.sh
因为你
我愿意成为一个更好的人
不想成为你的包袱
因此发奋努力
只是为了想要证明我足以与你相配