Centos7.4系統 httpd模式搭建文件服務器

環境:服務環境:centos7.4

說明:搭建Apache文件服務器,下載路徑為/opt/ymyg(下載路徑根據實際需要自己定義)

Centos7.4系統 httpd模式搭建文件服務器


步驟:

1、安裝httpd服務

[root@localhost ~]# yum -y install httpd

2、啟動服務並查看服務狀態

<code>[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl status httpd/<code>

3、修改端口和訪問路徑(根據實際需求進行)

Centos7.4系統 httpd模式搭建文件服務器

<code>[root@localhost ~]# vi /etc/httpd/conf/httpd.conf 
....42行
Listen 21288 #修改端口,默認80端口。
...略/<code>

DocumentRoot "/opt/ymyg" #修改路徑

<code># Relax access to content within /var/www.
#124-131行
<directory>
AllowOverride None
# Allow open access:
Require all granted
/<directory>

# Further relax access to the default document root:
<directory>
#
...略/<directory>/<code>
Centos7.4系統 httpd模式搭建文件服務器

4、重啟服務

<code>[root@localhost ~]# systemctl restart httpd/<code>

5、查看頁面是否正常

Centos7.4系統 httpd模式搭建文件服務器


6、刪除或備份apache的歡迎頁面

<code>[root@localhost ~]# mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf-bak/<code>

7、重啟服務

<code>[root@localhost ymyg]# systemctl restart httpd/<code>

8、再次訪問頁面

Centos7.4系統 httpd模式搭建文件服務器


結束


分享到:


相關文章: