環境:服務環境:centos7.4
說明:搭建Apache文件服務器,下載路徑為/opt/ymyg(下載路徑根據實際需要自己定義)
步驟:
1、安裝httpd服務
[root@localhost ~]# yum -y install httpd
2、啟動服務並查看服務狀態
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl status httpd
3、修改端口和訪問路徑(根據實際需求進行)
[root@localhost ~]# vi /etc/httpd/conf/httpd.conf Listen 21288 #修改端口,默認80端口。
DocumentRoot "/opt/ymyg" #修改路徑
#修改路徑 <Directory "/opt/ymyg"> AllowOverride None # Allow open access: Require all granted </Directory> # Further relax access to the default document root: <Directory "/opt/ymyg"> # ...略
4、重啟服務
[root@localhost ~]# systemctl restart httpd
5、查看頁面是否正常
6、刪除或備份apache的歡迎頁面
[root@localhost ~]# mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf-bak
7、重啟服務
[root@localhost ymyg]# systemctl restart httpd
8、再次訪問頁面
結束