AI智能
改变未来

shell脚本一键安装lnmp

#!/bin/bash#安装nginx依赖yum -y install gcc gcc-c++ pcre-devel zlib-devel openssl-devel#解压nginx安装包tar zxf nginx-1.12.2.tar.gzcd nginx-1.12.2#编译安装./configure && make && make install#对配置文件进行修改(加入php配置)sed -i \"45c index  index.php index.html index.htm;\" /usr/local/nginx/conf/nginx.confsed -i \"65c location ~ \\.php$ {\"  /usr/local/nginx/conf/nginx.confsed -i \"66c root           html;\"  /usr/local/nginx/conf/nginx.confsed -i \"67c fastcgi_pass   127.0.0.1:9000;\"  /usr/local/nginx/conf/nginx.confsed -i \"68c fastcgi_index  index.php;\"  /usr/local/nginx/conf/nginx.confsed -i \"69c fastcgi_param  SCRIPT_FILENAME $\\document_root$\\fastcgi_script_name;\"  /usr/local/nginx/conf/nginx.confsed -i \"70c include        fastcgi_params;\"  /usr/local/nginx/conf/nginx.confsed -i \"71c }\"  /usr/local/nginx/conf/nginx.conf#安装 mysql以及php组件yum -y install mariadb mariadb-server mariadb-devel php php-mysql php-fpm#写php测试页echo \"<?phpphpinfo();?>\" >/usr/local/nginx/html/index.php#创建软链接ls -s /usr/local/nginx/sbin/nginx#启动mysqlsystemctl start mariadb#启动phpsystemctl start php-fpm#关闭防火墙和selinuxsystemctl stop firewalldsetenforce 0
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » shell脚本一键安装lnmp