1、构建LAMP平台 1. 什么是LAMP 网站:一个和多个网页所组成的 编写网站的语言: PHP、Python、perl、Java、.net ... 数据库: Oracle、MySQL、Sql Server ... Web服务器: Apache、Nginx、IIS ... 操做系统: Linux、Windows、Unix ... Linux+Apache+MySQL+PHP(Web网站搭建黄金组合) Windows+IIS+Sql Server+.net 2.关闭防火墙和Selinux 关闭防火墙 [root@svr7 ~]# systemctl disable firewalld --now 关闭Selinux [root@ntd1711 ~]# vim /etc/sysconfig/selinux ... 7 SELINUX=disabled //确保是disabled ... 2、Web及数据库配置 1.Apache介绍 Web服务器,默认监听TCP 80端口 软件包名:httpd 主配置文件:/etc/httpd/conf/httpd.conf 默认网页存放位置:/var/www/html 2.主配置文件中重要的参数 # vim /etc/httpd/conf/httpd.conf ... 42 Listen 80 //端口号 ... 66 User apache //运行用户 67 Group apache //运行组 ... 95 #ServerName www.example.com:80 //本网站注册的DNS名称 ... 119 DocumentRoot "/var/www/html" //网页部署根目录 ... 164 DirectoryIndex index.html //默认首页名 ... 3.虚拟主机 在一台Web服务器上能够实现多个Web服务,为用户提供多个不一样的Web网站 基于域名虚拟主机: 用户访问不一样的域名,能够获得不一样的网站,可是不一样的域名指向的是同一个服务器IP 4./etc/hosts文件 早期实现dns域名解析功能的文件 eg: [root@ntd1711 html]# ping tts8.tedu.cn [root@ntd1711 html]# ping ne.tedu.cn [root@ntd1711 html]# vim /etc/hosts 在下面添加一行 127.0.0.1 tts8.tedu.cn ne.tedu.cn