AI智能
改变未来

Os 7 shell脚本安装lnmp

创建放置shell的目录

[root@localhost ~]# mkdir /shell

编辑shell脚本

[root@localhost ~]# vim /shell/lnmp.sh#!/bin/bashyum -y install epel-release &> /dev/nullyum -y clean all &> /dev/nullyum -y install nginx php php-fpm mariadb-server &> /dev/nullsed -i \"45c index index.php  index.html index.htm;\" /etc/nginx/nginx.conf.defaultsed -i \"65c location ~ \\\\\\.php$ {\"  /etc/nginx/nginx.conf.defaultsed -i \"66c root           html;\"  /etc/nginx/nginx.conf.defaultsed -i \"67c fastcgi_pass   127.0.0.1:9000;\"  /etc/nginx/nginx.conf.defaultsed -i \"68c fastcgi_index  index.php;\"  /etc/nginx/nginx.conf.defaultsed -i \"69c fastcgi_param  SCRIPT_FILENAME \\$document_root\\$fastcgi_script_name;\"  /etc/nginx/nginx.conf.defaultsed -i \"70c include        fastcgi_params;\"  /etc/nginx/nginx.conf.defaultsed -i \"71c }\"  /etc/nginx/nginx.conf.defaultcp -rf /etc/nginx/nginx.conf.default /etc/nginx/nginx.confecho -e \"<?php\\nphpinfo();\\n?>\" > /usr/share/nginx/html/index.phpsystemctl restart php-fpmsystemctl restart nginxsystemctl stop firewalldsetenforce 0

测试

[root@localhost ~]# cd /shell/[root@localhost shell]# sh lnmp.sh[root@localhost shell]# curl -I 192.168.33.137HTTP/1.1 200 OK#显示200 及为成功
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » Os 7 shell脚本安装lnmp