ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
一,安装Apache yum install httpd -y,安装apache,版本为2.4.6,最新为2.4.9。 cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak; vim /etc/httpd/conf/httpd.conf (默认唯一) ![](https://box.kancloud.cn/5fc77c4ea95a4c742e9f6bed53760186_476x130.png) 端口改为8000,不能与Nginx重叠。 ![](https://box.kancloud.cn/171d59a500356f8393061dd84e3b0bb5_299x163.png) ~~~ <VirtualHost *:8000> DocumentRoot "/home/admin/tp5/public" ServerName 007.liangyishipin.com:8000 <Directory "/home/admin/tp5"> Options FollowSymLinks Indexes Require all granted AllowOverride All </Directory> </VirtualHost> ~~~ systemctl start httpd,启动httpd. systemctl enable httpd,设置httpd服务开机启动. systemctl disable httpd.service 停止开机自启动 systemctl status httpd,查看服务状态. ![](https://box.kancloud.cn/62ed3092ab3925f0c8b4ce91bdcf10d3_655x210.png) 二,安装mysql5.7 (0),列出所有被安装的rpm package rpm -qa | grep mariadb 强制卸载,因为没有--nodeps rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64(举例) (1). 下载mysql的repo源 wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm 查看可以被安装的mysql列表(默认只有mysql57-community/x86_64允许安装,最稳定) yum repolist all | grep mysql (2). 安装mysql57-community-release-el7-11.noarch.rpm包 sudo rpm -Uvh mysql57-community-release-el7-11.noarch.rpm (3). 安装mysql sudo yum install mysql-server -y (4)登录时有可能报这样的错:ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2), 原因是/var/lib/mysql的访问权限问题。下面的命令把/var/lib/mysql的拥有者改为当前用户: sudo chown -R openscanner:openscanner /var/lib/mysql 然后,重启服务: service mysqld restart (5),修改密码 mysql -u root mysql mysql> UPDATE user SET Password=PASSWORD('123456') where USER='root'; mysql> FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误 mysql> \q (5)解决Navicat 出错:1130-host . is not allowed to connect to this MySql server,MySQL ~~~ mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; //赋予任何主机访问数据的权限 mysql>FLUSH PRIVILEGES; //修改生效 ~~~ 你想myuser使用mypassword从任何主机连接到mysql服务器的话。 ~~~ GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'dongshang2018' WITH GRANT OPTION; FLUSH PRIVILEGES; ~~~ 如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器,并使用mypassword作为密码 ~~~ GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; FLUSH PRIVILEGES; ~~~ 如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器的dk数据库,并使用mypassword作为密码 ~~~ GRANT ALL PRIVILEGES ON dk.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; FLUSH PRIVILEGES; ~~~ (6) mysql官方下载地址 https://dev.mysql.com/downloads/repo/yum/ ![](https://box.kancloud.cn/dd9ac969a97f9988f8f8a2338a9d0289_1238x399.png) 三,安装PHP7.2 1,# yum install epel-release -y rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm 2使用yum list命令查看可安装的包(Packege)。 3安装PHP5.6 yum install -y php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml php72w-bcmath php72w-dba php72w-enchant php72w-imap php72w-interbasephp72w-intl php72w-ldap php72w-mcrypt php72w-odbc php72w-pdo_dblib php72w-pear php72w-pecl-apcu php72w-pecl-imagick php72w-pecl-xdebug php72w-pgsql php72w-phpdbg php72w-process php72w-pspell php72w-recode php72w-snmp php72w-soap php72w-tidy php72w-xmlrpc php72w-pecl-igbinary php72w-intl php72w-memcached php72w-pecl-mongodb 4连接mysql rpm -ql php72w-mysqlnd 四,安装nginx1.12 1#rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm 2使用下面命令安装nginx yum install nginx -y 3启动Nginx service nginx start 4 配置nginx支持php cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak vim /etc/nginx/conf.d/default.conf (default.conf名字随便改,默认一个域名一个配置文件)(无需更改nginx.conf配置文件) ![](https://box.kancloud.cn/26992edec6f7e625bb78a107018c1d45_431x175.png) ![](https://box.kancloud.cn/74d501b8fc0eb74adddb5cde4f30abf5_565x174.png) 修改www.conf文件 vim /etc/php-fpm.d/www.conf (默认一个网站根目录对应一个配置文件,www.conf名字随便改) ![](https://box.kancloud.cn/5ed3dfc364716ddf66eaa9f971eb9687_365x154.png) service php-fpm start 启动php-fpm service nginx restart 重启nginx 五,安装vsftpd yum install -y vsftpd cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.bak vim /etc/vsftpd/vsftpd.conf 将anonymous_enable=YES 改为anonymous_enable=NO关闭匿名用户登入 修该网站根目录权限 chmod 777 /home/web chmod 777 /home/admin 关闭setenforce (临时关闭) setenforce 0 修改/etc/selinux/config 文件 将SELINUX=enforcing改为SELINUX=disabled 重启机器即可 开放防火墙端口 firewall-cmd --zone=public --add-port=22/tcp --add-port=80/tcp --add-port=21/tcp --add-port=20/tcp --add-port=3306/tcp --add-port=443/tcp --add-port=8877/tcp --add-port=9988/tcp --permanent 重启防火墙 firewall-cmd --reload 查看进程 netstat -tulp ![](https://box.kancloud.cn/71ec102d99256a457a4965d2c5c9376e_724x167.png)