笔记6
- rm -f /var/run/yum.pid 清理睡眠状态
rm -f /var/run/yum.pid |
开放防火墙
firewall-cmd --permanent --zone=public --add-port=3306/tcp
firewall-cmd --permanent --zone=public --add-port=3306/udp
firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --permanent --zone=public --add-port=80/udp
firewall-cmd --reload
systemctl stop firewalld关闭selinux
vi /etc/selinux/config
将SELINUX=enforcing这一行修改为SELINUX=disabledreboot
删除默认数据库
rpm -qa | grep mariadb 查找出默认数据库mariadb的包名。
yum remove mariadb-libs.x86_64 删除yum install httpd -y
systemctl enable httpd
systemctl restart httpd
systemctl status httpd //查看服务状态
此时访问成功回显apache测试页,网站根目录/var/www/html安装mysql
yum -y install mariadb mariadb-server
systemctl enable mariadb
systemctl start mariadb
mysql_secure_installationmysql -uroot -p 123456
GRANT ALL PRIVILEGES ON . TO ‘root‘@’%’ IDENTIFIED BY ‘123456’ WITH GRANT OPTION;FLUSH PRIVILEGES; 远程登陆完成。
exit 退出
php安装
- rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
- yum -y remove php*
- yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml
- systemctl enable php-fpm.service
systemctl start php-fpm.service
配置Apache解析php文件并自动关联
- vi /etc/httpd/conf/httpd.conf
- 找到:DirectoryIndex index.html改为:DirectoryIndex index.html index.htm index.php
- 找到:AddType application/x-gzip .gz .tgz在该行下面添加:AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
- 重启Apache:systemctl restart httpd
- 在浏览器输入服务器IP地址或者绑定的域名访问即可,html文件下是网站主目录,如果是里面有个文件夹才是主目录可以在配置文件修改主目录路径,或者在IP地址访问后面加上文件夹名字。
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.