企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
CentOS 7版本配置lamp服务器和其他版本命令有变动。centos7以上版本也可按照这个文档安装配置。 服务器配置要求:操作系统:LINUX;Web服务器:Nginx(推荐) >= 1.8.0 ;PHP版本:= 5.4; MariaDB:= 5.5.6;Memcached:>= 1.4.2;PHP扩展:memcached fileinfo openssl Zend Guard Loader; Zend Guard Loader 下载地址:https://www.zend.com/en/products/loader/downloads#Linux 关闭firewall:CentOS 7.0 7.2默认使用的是firewall作为防火墙 ~~~bash systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 ~~~ 关闭SELINUX ~~~bash vi /etc/selinux/config #SELINUX=enforcing #注释掉 #SELINUXTYPE=targeted #注释掉 SELINUX=disabled #增加 :wq! #保存退出 ~~~ `setenforce 0 #使配置立即生效` ~~~bash yum install epel-release -y yum localinstall --nogpgcheck http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y yum install ntsysv lrzsz lsof sysstat iotop nohup bzip2-devel openssl-devel ~~~ 一、安装nginx ~~~bash yum install nginx#根据提示,输入Y安装即可成功安装或者yum install nginx -y systemctl nginx nginx.service #启动nginx systemctl stop nginx.service #停止nginx systemctl restart nginx.service #重启nginx systemctl enable nginx.service #设置nginx开机启动 ~~~ 二、安装MariaDB 也就是MySQL ~~~bash yum install mariadb mariadb-server #询问是否要安装,输入Y即可自动安装,直到安装完成 systemctl start mariadb.service #启动MariaDB systemctl stop mariadb.service #停止MariaDB systemctl restart mariadb.service #重启MariaDB systemctl enable mariadb.service #设置开机启动 ~~~ 2、为root账户设置密码 ` mysql_secure_installation` 回车,根据提示输入Y 输入2次密码,回车 根据提示一路输入Y 最后出现:Thanks for using MySQL! MariaDB密码设置完成,重新启动 MariaDB: `systemctl restart mariadb.service #重启MariaDB` 三、安装PHP 1、安装PHP ` yum install php #根据提示输入Y直到安装完成` 2、安装PHP组件 ~~~bash yum install php-fpm php-mysqlnd php-mbstring php-gd redis php-redis memcached php-memcache php-memcached php-bcmath php-mcrypt #这里选择以上安装包进行安装,根据提示输入Y回车 systemctl restart mariadb.service #重启MariaDB systemctl restart nginx.service #重启nginx ~~~ 配置 一、nginx配置 ~~~bash sed -i '/fastcgi.conf/'d /etc/nginx/nginx.conf sed -i '/^http {/a\ include fastcgi.conf;' /etc/nginx/nginx.conf sed -i '/ types_hash_max_size 2048;/afastcgi_buffers 8 64k;' /etc/nginx/nginx.conf sed -i '/ types_hash_max_size 2048;/afastcgi_buffer_size 64k;' /etc/nginx/nginx.conf sed -i '/ types_hash_max_size 2048;/afastcgi_read_timeout 300;' /etc/nginx/nginx.conf sed -i '/ types_hash_max_size 2048;/afastcgi_send_timeout 300;' /etc/nginx/nginx.conf sed -i '/ types_hash_max_size 2048;/afastcgi_connect_timeout 300;' /etc/nginx/nginx.conf sed -i '/ types_hash_max_size 2048;/aclient_max_body_size 20m; ' /etc/nginx/nginx.conf systemctl restart nginx.service #重启nginx ~~~ 二、php配置 ~~~bash sed -i 's/ max_input_vars = 1000/amax_input_vars = 5000' /etc/php.ini sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 4M/g' /etc/php.ini sed -i 's/user = apache/user = nginx/g' /etc/php-fpm.d/www.conf sed -i 's/group = apache/group = nginx/g' /etc/php-fpm.d/www.conf systemctl restart mariadb.service #重启MariaDB systemctl restart nginx.service #重启nginx service php-fpm restart service memcached start ~~~ 扩展安装 需要安装ZendGuardLoader.so 至此环境已经配置完成。