linux-网站服务
一、概念
1、框架结构
LAMP:linux+apache+mysql+PHP
系统+服务器程序+数据管理软件+中间软件
二、静态站点
1、安装Apache
//安装
//启动
//设置开机自启动
//临时关闭
//关闭防火墙
//查看版本
Server version: Apache/2.4.6 (CentOS)
Server built: Mar 24 2022 14:57:57
2、虚拟主机
服务器:
目的:
在一台物理服务器上运行多个网站
在一台物理服务器上运行多个网站
类型:基于域名(主机名)
www.a站点设置:
(1)准备网站源码(网页)目录
//写内容在www.a.org网页中
(2)创建a.org的网站配置文件
<VirtualHost *:80>//
DocumentRoot /var/www/html/a.org//网页根目录
</VirtualHost>
(3)检测配置文件语法,重启服务
//检测
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
Syntax OK
//重启
客户端:
(1)linux客户端域名解析
192.168.32.138 www.a.org
(2)linux客户端测试网站可用性
用客户端访问服务器域名
三、动态网站
部署论坛系统
1、安装LAMP
[[email protected] ~]# systemctl start httpd mariadb
//重启
(1)创建网站源码
//下载压缩包
--2022-08-21 16:06:56-- http://download.comsenz.com/DiscuzX/2.5/Discuz_X2.5_SC_UTF8.zip
正在解析主机 download.comsenz.com (download.comsenz.com)... 81.69.153.197, 150.158.237.100, 49.234.165.129, ...
正在连接 download.comsenz.com (download.comsenz.com)|81.69.153.197|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Moved Temporarily
位置:https://download.comsenz.com/DiscuzX/2.5/Discuz_X2.5_SC_UTF8.zip [跟随至新的 URL]
--2022-08-21 16:06:56-- https://download.comsenz.com/DiscuzX/2.5/Discuz_X2.5_SC_UTF8.zip
正在连接 download.comsenz.com (download.comsenz.com)|81.69.153.197|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:9509959 (9.1M) [application/zip]
正在保存至: “Discuz_X2.5_SC_UTF8.zip”
100%[=============================================>] 9,509,959 168KB/s 用时 50s
2022-08-21 16:07:46 (184 KB/s) - 已保存 “Discuz_X2.5_SC_UTF8.zip” [9509959/9509959])
//创建文件夹/webroot/discuz
//安装解压工具
//解压
//把upload中的所有文件复制到/webroot/discuz中
虚拟主机:
<VirtualHost *80>
ServerName www.discuz.com
DocumentRoot /webroot/discuz
</VirtualHost>
<Directory "/webroot/discuz">
Require all granted
</Directory>
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 3
Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]> create database discuz;
Query OK, 1 row affect
[[email protected] ~]# vim /etc/hosts
192.168.32.138 www.discuz.com
通过域名访问
