一.网站架构——LAMP
Linux+Apache+MySQL+PHP
系统+服务器程序+数据管理软件+中间软件
网站服务名词解释:
二.静态站点
2.1安装Apache(准备环境)
yum -y install httpd 安装http
systemctl start httpd 启动http
systemctl status httpd 查看服务状态
systemctl enable httpd 开机自启
systemctl stop firewalld 关闭防火墙
setenforce 0 关闭selinux
httpd -v 查看版本
2.2虚拟主机
2.2.1建服务器
环境:
192.168.129.130 web服务器
192.168.129.128 客户机
192.168.129.1 真机
2.2.2服务器 192.168.129.130
A.站点设置 www.a.org
准备网站源码(网页)目录 #mkdir /var/www/html/http://a.org
#vim /var/www/html/http://a.org/index.html 在里面输入内容保存退出
创建http://a.org的网站配置文件 #vim /etc/httpd/conf.d/a.org.conf
<VirtualHost *:80>
ServerName www.a.org
DocumentRoot /var/www/html/http://a.org
</VirtualHost>
检测配置文件语法,重启服务 #httpd -t
#systemctl restart httpd
B.站点设置 www.b.org
准备网站源码目录# mkdir /http://b.org
#vim /http://b.org/index.html 进入编辑内容
创建http://b.org的网站配置文件#vim /etc/httpd/conf.d/b.org.conf
<VirtualHost *:80>
ServerName www.b.org
DocumentRoot /http://b.org
</VirtualHost>
<Directory "/b.org">
Require all granted
</Directory>
检测配置文件语法,重启服务#httpd -t
#systemctl restart httpd
2.2.2配置客户端
A.192.168.129.128
Linux客户端域名解析 #vim /etc/hosts
192.168.129.130 www.a.org
192.168.129.130 www.b.org
Linux客户端测试网站可用性 字符测试 #yum install -y elinks
#elinks http://www.a.org
#elinks http://www.b.org