LAMP 为 Linux、Apache、MySQL、PHP 的简称,这是一个常规的 Web 服务器环境解决方案,使用其首字母缩写“LAMP”来引用。
systemctl stop firewalld systemctl enable firewalld
禁用 Selinux
vim /etc/selinux/config
修改为 disabled
SELINUX=disabled
注意:上面配置是重启后才生效,所以需要临时关闭selinux防火墙
setenforce 0
yum -y install httpd
启动Apache
systemctl start httpd //启动apache systemctl enable httpd //设置apache开机启动 systemctl status httpd //查看服务状态
启动后在外部浏览器访问主机IP就能看到Apache页面
httpd -t
如果有以下提示可忽略
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
cd /var/www/html mkdir web1 vim index.html
添加网页内容
<h1 style="color:#D81B60">Hello Multisite! </h1>
<VirtualHost *:80> ServerAdmin feng@gmail.com DocumentRoot /var/www/html/web1 ServerName web1.frg.com ErrorLog logs/web1-frg-com-error_log CustomLog logs/web1-frg-com-access_log common </VirtualHost>
# 检查配置文件 httpd -t # 重启服务 systemctl restart httpd
使用 IP 访问
配置多站点配置文件
cd /var/www/html mkdir web2 vim index.html
添加网页内容
<h1 style="color:#D81B60">Hello Multisite! </h1>
<VirtualHost *:8899> ServerAdmin feng@gmail.com DocumentRoot /var/www/html/web2 ServerName web2.frg.com ErrorLog logs/web2-frg-com-error_log CustomLog logs/web2-frg-io-access_log common </VirtualHost>
# 检查配置文件 httpd -t # 重启服务 systemctl restart httpd
浏览器通过域名:8899访问
《CentOS7安装并配置本地DNS服务器》 https://www.cnblogs.com/LzsCxb/p/15713510.html
vim /etc/named.rfc1912.zones zone "frg.com" IN { type master; file "feng.io.zone"; allow-update { none; }; };
cd /var/named cp -p named.localhost frg.com.zone vim named.localhost frg.com.zone
重启 DNS 服务器
systemctl restart named
Linux:
sudo vim /etc/resolv.conf
增加自己本地的DNS服务器地址到顶部
重启网络即可使用域名访问
window:
192.168.139.100 frg.com
《CentOS7 安装 Mysql8 并配置远程登录》 https://www.cnblogs.com/LzsCxb/p/15366225.html
下载 PHP7 源码包
wget https://www.php.net/distributions/php-7.4.27.tar.gz