Centos7搭建apache文件服务器

1、安装apache服务器

yum install httpd

2、启动httpd服务

systemctl start httpd.service

3、查看版本

httpd -v

4、修改端口

httpd默认端口为80,为避免端口冲突,建议改端口

vi /etc/httpd/conf/httpd.conf
image

5、重启服务

systemctl restart httpd.service
浏览器访问IP:8000
image
可以看有右边的提示 将 web 程序放在/var/www/html 在最终使用前屏蔽/etc/httpd/conf.d/welcome.conf

httpd的默认配置文件是/etc/httpd/conf/httpd.conf 这个算是附加配置。

设置 该文件

vim /etc/httpd/conf.d/welcome.conf
1
# 
# This configuration file enables the default "Welcome" page if there
# is no default index page present for the root URL.  To disable the
# Welcome page, comment out all the lines below. 
#
# NOTE: if this file is removed, it will be restored on upgrades.
#

大概就是 如果没有默认的初始页就会使用这个配置文件 指定的内容作为欢迎页。如果想要屏蔽掉欢迎页,就把所有行注释掉。。。如果删除了该文件,它会在升级恢复。

于是把所有内容屏蔽掉
image

8、上传文件
默认文件根路径为:/var/www/html,也可以通过修改配置文件自定义文件路径
image

只需要把文件放到根路径就可以了
image
此时会发现中文文件名出现了乱码

9、中文乱码
在配置文件中加上 IndexOptions Charset=UTF-8 即可解决中文乱码问题
image

参考链接:https://blog.csdn.net/Sterry_Gong/article/details/108152898

posted @ 2021-08-08 09:53  老头还我葵花宝典  阅读(210)  评论(0编辑  收藏  举报