web服务器搭建
mirrors.163 网易镜像
基本命令 文本命令 用户管理命令 文件管理命令 网络管理
http 80 8080 https 443
URI:统一资源定位符URI: http://www.baidu.com/*.html:80
Web服务器:Apache.Microsoft的Internet信息服务器 unix nginx
概念:web www http
Apache unix nginx IIS
浏览器 http://www.baidu.com:80/index.html
请求 响应报文
S/C S/B
yum install httpd -y
rpm -ql httpd
tree /etc/htttpd
Firewalld selinux
仅主机
Nat VMNAT1
桥接
mount /dev sr0 /mnt
vim /etc /yum.repos.d/base.repo
[Base0S] (源名称)
name#BaseOS
baseurl#file:///mnt/BaseOS
gpgcheck=0 (开启公私钥验证)
[AppStream] (源名称)
name#AppStream
baseurl#file:///mnt/AppStream
gpgcheck=0 (开启公私钥验证)
:wq
dnf(运行) install httpd -y
patree(树状结构)
systemctl start httpd ^c
man systemctl(man手册)
(start list-units stop reload restart kill is-active status状态 enable自启动 )
–now ^c
systemctl enable httpd --now
systemctl start httpd
systemctl stop firewalld
setenforce (强制状态) 0关闭
systemctl disable firewalld (永久关闭)
vim / etc /selinux/config(永久关闭)
SELINUX=permissive
win主机 http://lnuix ip地址/
rpm -ql httpd 查看软件文件包
.conf配置文件
run目录(进程信息)htcacheclean缓存
.so动态链接库
lib
sbin管理员可执行的文件
share/doc 文档信息
var目录 动态可变化信息(日志)tail -f /var/log/messages
cd /var/www/html
vim index.html
helloworld
mkdir 1
vim 1/index.html
this is 1
:wq
配置文件
/etc/httpd/conf ------主配置目录
httpd.conf 主配置文件
/etc/httpd/conf.d/-------子(辅助)配置目录
userdir.conf
welcome.conf
autoindex.conf
/etc/httpd/conf.modules.d------子模块配置目录
vim /etc/httpd/conf/httpd.conf
ps(进程) -aux | grep httpd
DocumentrRoot
同一IP不同端口对应不同网页
ServerRoot /etc/httpd 服务主目录(配置当中所涉及到的文件的主路径)
Listen 80 监听端口
Include conf.modules.d/*conf
User apache
Group apache
ServerAdmin 管理员账户
ServerName www.—.com:80
DocumentRoot"/var/www/html"文本主目录(网站的主界面文件路径)
<Directory"/var/www/html">
AllowOverride none
Require all granted 允许
vim /etc/httpd/conf.d/welcom.conf
rpm -ql httpd | grep vhosts
vim / usr/share/doc/httpd/httpd-vhosts.conf
配置多网站 http://ip 域名 :80
vim /etc/httpd/conf.d/vhosts.conf
同一主机不同ip对应不同网页
#ServerAdmin A ServerName ip DocumentRoot /A ErrorLog"" CustomLog""<Directory /A>
AllowOverride none
Require all granted
mkdir /A
vim /A/index.html
内容
systemctl restart httpd
添加ip