一、安装Apache
sudo apt-get install apache2
二、修改服务器访问端口
Apache2的默认访问端口为80,可修改为其他端口(当端口被占用时需要更改其访问端口)
进入apache2的安装目录 /etc/apache2/,修改ports.conf文件
cd /etc/apache2/
sudo chmod 775 ports.conf
vim ports.conf
三、查看apache服务器的默认目录配置文件
进入 目录 /etc/apache2/sites-available, 查看000-default.conf文件
cd /etc/apache2/sites-available
vim 000-default.conf
四、Apache服务器默认页面改为文件服务器
apache服务器的默认目录在/var/www/html,如果想利用http服务器下载文件,需要删除其index.html文件,然后把文件放在该目录即可
cd /var/www/html
sudo rm -rf index.html
五、启动Apache服务器
#启动Apache服务器
sudo /etc/init.d/apache2 start
六、访问服务器
liunx本地浏览器可以输入 “localhost:端口” 访问文件服务器
同局域网下的浏览器输入Liunx服务器的“IP地址:端口”访问文件服务器
出现该页面就代表已搭建成功!