Scripting automatic deployment of reverse proxy, Web, NFS

Source: Internet
Author: User

Server-side
#!/bin/bashfunction Nginx_install () {if [[-f/usr/sbin/nginx]]; Thenecho ' Nginx has been installed. ' Exitelseflag1=3while [[$flag 1-GT 0]]; Doyum Install epel-release-y && yum install nginx-yif [[$?-ne 0]]; Then ((flag1--)) Elseecho ' Nginx had 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 $msg 1"/etc/nginx/nginx.confsed-ri "/^ *location \ \{$/a $msg 2"/etc/nginx/nginx.confsystemctl Reload Nginx}function Nfs_install () {rpm-qa |grep rpcbind >>/dev/nullif [[$?-eq 0]]; Thenecho ' Rpcbind has been install Ed ' Elseflag2=3while [[$flag 2-gt 0]; Doyum install Rpcbind-yif [[$-ne 0]]; Then ((flag2--)) Elseecho ' RPCbind have been installed. ' Exitfidoneecho ' RPCbind install failed. ' Firpm-qa |grep nfs-utils >>/dev/nullif [[$?-eq 0]]; Thenecho ' Nfs-utils has beenInstalled ' Elseflag3=3while [[$flag 3-gt 0]; Doyum install Nfs-utils-yif [[$-ne 0]]; Then ((flag3--)) Elseecho ' nfs-utils have 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_installnginx_balancernfs_ Installnfs_server

  

Client
#!/bin/bashfunction Nginx_install () {if [[-f/usr/sbin/nginx]]; Thenecho ' Nginx has been installed. ' Exitelseflag1=3while [[$flag 1-GT 0]]; Doyum Install epel-release-y && yum install nginx-yif [[$?-ne 0]]; Then ((flag1--)) Elseecho ' Nginx had been installed. ' Exitfidoneecho ' Nginx install failed. ' Fisystemctl start Nginx}function Nfs_install () {rpm-qa |grep rpcbind >>/dev/nullif [[$?-eq 0]]; Thenecho ' Rpcbin D has been installed ' elseflag2=3while [[$flag 2-gt 0]; Doyum install Rpcbind-yif [[$-ne 0]]; Then ((flag2--)) Elseecho ' RPCbind have been installed. ' Exitfidoneecho ' RPCbind install failed. ' Firpm-qa |grep nfs-utils >>/dev/nullif [[$?-eq 0]]; Thenecho ' nfs-utils has been installed ' elseflag3=3while [[$flag 3-gt 0]; Doyum install Nfs-utils-yif [[$-ne 0]]; Then ((flag3--)) Elseecho ' nfs-utils have 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_installnfs_installnfs_client

  

Scripting automatic deployment of reverse proxy, Web, NFS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.