1.概念
1.前言:UI的转变:B/S架构
2.名词:
HTML:HyperText Markup Language 超级 文本 标记 语言
网页:使用HTML,PHP,JAVA语言格式书写的文件。
主页:网页中呈现用户的第一个页面。
网站:多个网页组合而成的一台网站服务器
URL:http://www.baidu.com:80/1.html
ftp://192.168.142.143:21/1.txt
Uniform Resource Locator
统一资源定位符
访问网站的地址
3.网站架构:
LAMP:
Linux + Apache + MySQL + PHP
系统+服务器程序+数据管理软件+中间软件
2.静态站点
1.Apache:建议使用2.4及以上的版本
2.Apache基础:
Apache官网: www.apache.org
软件包名称: httpd
服务端口: 80/tcp(http) 443/tcp(https)
主配置文件: /etc/httpd/conf/httpd.conf
子配置文件:/etc/httpd/conf.d/*.conf
主目录:/var/www/html网站源代码默认位置
3.安装Apache:yum -y install httpd安装
systemctl start httpd启动
systemctl status httpd查看服务状态
systemctl enable httpd开机自启
systemctl stop firewalld关闭防火墙
setenforce 0关闭selinux
httpd -v查看版本
4.虚拟主机:
目的:
虚拟主机VirtualHost
作用:在一台物理服务器上运行多个网站
类型:
基于主机名
www.a.org
www.b.org
配置虚拟主机目标:
在一台服务器上,实现两个网站的架设
网站域名 网站资源存放目录
www.a.org /var/www/html/a.org
www.b.org /b.org
注意关闭firewalld和selinux
环境:
10.8.162.165web服务器
10.8.162.88客户机
192.168.142.1真机
同上一台linux客户机
服务器:10.8.162.165
1.准备网站源码:mkdir /var/www/html/a.org
vim /var/www/html/a.org/index.html 输入397039762
vim /etc/httpd/conf.d/a.org.conf
httpd -t 重启服务# systemctl restart httpd
www.b.org站点设置
1.准备网站源码目录:
mkdir /b.org
vim /b.org/index.html
2.创建b.org的网站配置文件:
vim /etc/httpd/conf.d/b.org.conf
httpd -t #重启systemctl restart httpd
Linux客户端域名解析
vim /etc/hosts
10.8.162.88 www.a.org填写web服务器的IP
Windows客户端域名解析
3.动态站点
1.LAMP:linux系统-网站程序apache-数据库mysql-PHP中间件
2.部署论坛系统discuz:
logo: 开源论坛代码服务社区
一、基础环境
sed -ri '/^SELINUX=/cSELINUX=disabled' /e
setenforce 0
systemctl stop firewalld.service关闭防火墙
systemctl disable firewalld.service 开机不自启
二,安装LAMP:
yum -y install httpd mariadb-server mariadb php php-mysql gd php-gd
设置重启systemctl restart httpd mariadb
设置开机自启:systemctl enable htppd martadb
三、安装Discuz!
- 导入discuz网站源码
wget http://download.comsenz.com/DiscuzX/2.5/Discuz_X2.5_SC_UTF8.zip
mkdir /webroot/boke
yum install -y unzip
解压缩unzip Discuz_X2.5_SC_UTF8.zip
cp -rf upload/* /webroot/boke
chown -R apache:apache /webroot/boke
Apache配置虚拟主机:vim /etc/httpd/conf.d/boke.conf
systemctl restart httpd
mysql
3.部署博客系统workpress:
logo:一、基础环境[已完成] sed -ri '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config setenforce 0 systemctl stop firewalld.service systemctl disable firewalld.service```
二、安装LAMP[已完成]
yum -y install httpd mariadb-server mariadb php php-mysql gd php-gd
systemctl start httpd mariadb
systemctl enable httpd mariadbApache 配置虚拟主机:
vim /etc/httpd/conf.d/bk.conf
<VirtualHost *:83>
ServerName www.wordpress.com
DocumentRoot /webroot/bk
</VirtualHost>
<Directory "/webroot/bk">
Require all granted
</Directory>导入wordpress网站源码:
mkdir -p /webroot/bk
unzip wordpress-4.9.4-zh_CN.zip
cp -rf wordpress/* /webroot/bk
chown -R apache:apache /webroot/bk
systemctl restart httpd
mysql
MariaDB [(none)]> create database wordpress ;5.不是网校系统edusoho:
一,基础环境:
sed -ri '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config
setenforce 0
systemctl stop firewalld.service
systemctl disable firewalld.service二,epel源:
yum install -y epel-release![](https://s4.51cto.com/images/blog/202008/21/27dd14cbd77c50d04428f4ebdb5e56ef.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
yum -y install bash-completion httpd php php-cli php-curl php-fpm php-intl php-mcrypt php-mysql php-gd php-mbstring php-xml php-dom mariadb-server mariadb
![](https://s4.51cto.com/images/blog/202008/21/fd4369db56c5fbd9228f09ba76d51869.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
systemctl start httpd mariadb
![](https://s4.51cto.com/images/blog/202008/21/a514ae963ee5153bcd382e52c73e864a.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
#mysql
MariaDB [(none)]> create database wx;![](https://s4.51cto.com/images/blog/202008/21/2a23b69ca6dac7a27815e2941542a512.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=) 设置上传限制:
网校的视频文件比较大,将默认的2M上传改大些。
vim /etc/php.ini
post_max_size = 1024M
memory_limit = 1024M
upload_max_filesize = 1024M
date.timezone = Asia/ShangHai
[可选]
vim /etc/php-fpm.d/www.conf
listen.owner = apache
listen.group = apache
listen.mode = 0666
systemctl start php-fpm
systemctl enable php-fpm
![](https://s4.51cto.com/images/blog/202008/21/6e231ecf71a9361bae978bf421cb26d7.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
六,上传源码
wget http://download.edusoho.com/edusoho-7.5.12.tar.gz
tar xf edusoho-7.5.12.tar.gz
mkdir -p /webroot/edusoho
cp -rf edusoho/* /webroot/edusoho
chown -R apache.apache /webroot/edusoho
![](https://s4.51cto.com/images/blog/202008/21/9f19d79834af15108c725c152830e782.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)![](https://s4.51cto.com/images/blog/202008/21/9b498289a103b307e06d0bc2a2fa6e28.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
七,设置虚拟主机:
vim /etc/httpd/conf.d/wx.conf
<VirtualHost *:84>
ServerName www.edusoho.com
DocumentRoot /webroot/wx/web
</VirtualHost>
<Directory "/webroot/wx/web">
Require all granted
</Directory>
![](https://s4.51cto.com/images/blog/202008/21/b7369995279ac6eab7b90d891f2b95c7.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
主配置文件添加端口:
vim /etc/httpd/conf/httpd.conf
![](https://s4.51cto.com/images/blog/202008/22/549707dfa5e14afe7a2949f926a280d2.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
在阿里云上添加端口![](https://s4.51cto.com/images/blog/202008/22/a9064e9c6b661ed8ce053affbe6bd5e6.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
来源:oschina
链接:https://my.oschina.net/u/4310671/blog/4528163