APACHE Web服务
yum install httpd -y ###安装httpd
systemctl start httpd ###打开httpd服务
/var/www/html ###apache默认配置目录
index.html ###apache默认主配置文件
cd /var/www/html
vim index.html ###apache默认主配置文件
写入:hello world
netstat -antlupe | grep httpd ###查看httpd的端口
在网站进行测试172.25.254.117
netstat -antlupe | grep httpd ###查看httpd的端口
vim /etc/http/conf/httpd.conf
将listen80改为listen8080
在网站测试172.25.254.117:8080
mkdir -p /westos/html
cd /westos/html
vim index.html
写入:westos'page
vim /etc/http/conf/httpd.conf
把119行,DocumentRoot "/var/www/html"注释掉
写入:从120行写入,DocumentRoot "/westos/html"
<Directory "/westos">
require all granted
</Directory>
在网站进行测试172.25.254.101
上面配置写完后,系统只会读默认配置文件index.html,若想读test.html还需要在主配置文件中修改
vim test.html
写入:westos'test'page
vim /etc/http/conf/httpd.conf
systemctl restart httpd
在刚才写的加入一行:DirectoryIndex test.html
在网站进行测试172.25.254.117
mkdir /westos/html/linux
cd /westos/html/linux
vim index.html
写入:/westos/html/linux'page
vim /etc/http/conf/httpd.conf
写入:在DocumentRoot "/westos/html"下面
<Directory "/westos/html/linux">
DirectoryIndex index.html
</Directory>
systemctl restart httpd
在网站进行测试172.25.254.117/linux
设定指定ip访问默认发布目录和文件
cd /var/www/html