日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

编写脚本自动部署反向代理、web、nfs

發(fā)布時間:2025/3/19 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 编写脚本自动部署反向代理、web、nfs 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

服務(wù)器端

#!/bin/bashfunction nginx_install(){if [[ -f /usr/sbin/nginx ]]; thenecho 'Nginx has been installed.'exitelseflag1=3while [[ $flag1 -gt 0 ]]; doyum install epel-release -y && yum install nginx -yif [[ $? -ne 0 ]]; then((flag1--))elseecho 'Nginx has been installed.'exitfidoneecho 'Nginx install failed.'fisystemctl start nginx }function nginx_balancer(){msg1='upstream myapp1 { server 192.168.60.129; server 192.168.60.130; server 192.168.60.131; }'msg2='proxy_pass http://myapp1;'sed -ri "/^http/a $msg1" /etc/nginx/nginx.confsed -ri "/^ *location \/ \{$/a $msg2" /etc/nginx/nginx.confsystemctl reload nginx }function nfs_install(){rpm -qa |grep rpcbind >> /dev/nullif [[ $? -eq 0 ]]; thenecho 'RPCbind has been installed'elseflag2=3while [[ $flag2 -gt 0 ]]; doyum install rpcbind -yif [[ $? -ne 0 ]]; then((flag2--))elseecho 'RPCbind has been installed.'exitfidoneecho 'RPCbind install failed.'firpm -qa |grep nfs-utils >> /dev/nullif [[ $? -eq 0 ]]; thenecho 'nfs-utils has been installed'elseflag3=3while [[ $flag3 -gt 0 ]]; doyum install nfs-utils -yif [[ $? -ne 0 ]]; then((flag3--))elseecho 'nfs-utils has been installed.'exitfidoneecho 'nfs-utils install failed.'fi }function nfs_server(){mkdir /sharetouch /share/index.htmlecho '---NFS---Hello---' > /share/index.htmlchmod -R o+w /shareecho '/share 192.168.60.0/24(rw,sync,fsid=0)' >> /etc/exportssystemctl start rpcbind.service && systemctl start nfs-server.serviceif [[ $? -eq 0 ]]; thenecho 'NFS server running.'fisystemctl enable rpcbind.service && systemctl enable nfs-server.service }nginx_install nginx_balancer nfs_install nfs_server

  

客戶端

#!/bin/bashfunction nginx_install(){if [[ -f /usr/sbin/nginx ]]; thenecho 'Nginx has been installed.'exitelseflag1=3while [[ $flag1 -gt 0 ]]; doyum install epel-release -y && yum install nginx -yif [[ $? -ne 0 ]]; then((flag1--))elseecho 'Nginx has been installed.'exitfidoneecho 'Nginx install failed.'fisystemctl start nginx }function nfs_install(){rpm -qa |grep rpcbind >> /dev/nullif [[ $? -eq 0 ]]; thenecho 'RPCbind has been installed'elseflag2=3while [[ $flag2 -gt 0 ]]; doyum install rpcbind -yif [[ $? -ne 0 ]]; then((flag2--))elseecho 'RPCbind has been installed.'exitfidoneecho 'RPCbind install failed.'firpm -qa |grep nfs-utils >> /dev/nullif [[ $? -eq 0 ]]; thenecho 'nfs-utils has been installed'elseflag3=3while [[ $flag3 -gt 0 ]]; doyum install nfs-utils -yif [[ $? -ne 0 ]]; then((flag3--))elseecho 'nfs-utils has been installed.'exitfidoneecho 'nfs-utils install failed.'fi }function nfs_client(){systemctl start rpcbind.service && systemctl start nfs-server.servicesystemctl enable rpcbind.service && systemctl enable nfs-server.servicemount -t nfs 192.168.60.128:/share /usr/share/nginx/html/df |grep 192.168.60.128 >> /dev/nullif [[ $? -eq 0 ]]; thenecho 'NFS client running.'fi }nginx_install nfs_install nfs_client

  

轉(zhuǎn)載于:https://www.cnblogs.com/freelandun/p/6754802.html

總結(jié)

以上是生活随笔為你收集整理的编写脚本自动部署反向代理、web、nfs的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。