在linux下使用Apache搭建檔案伺服器
阿新 • • 發佈:2020-12-17
[TOC]
# 一.關於檔案伺服器
在一個專案中,如果想把公共軟體或者資料共享給專案組成員,可以搭建一個簡易的檔案伺服器來實現,只要是在區域網內的成員都可以通過瀏覽器或者wget命令來下載和訪問資料。可以達到資訊共享,軟體版本一致的效果。本文講述在linux環境下使用Apache服務搭建檔案伺服器。
# 二.使用Apache搭建檔案伺服器
1.Apache服務在linux環境下的程式叫做httpd,所以首先安裝httpd服務,如果配置好了yum源的話,直接使用yum命令安裝,如果沒有配置好yum源的話,可以參考部落格“linux 配置本地yum源,配置國內yum源,配置epel源”進行配置,網址為:https://www.cnblogs.com/renshengdezheli/p/13949693.html
```shell
[root@node5 ~]# yum -y install httpd
```
2.啟動httpd服務
```shell
#啟動httpd服務
[root@node5 ~]# systemctl start httpd
#檢視httpd服務狀態
[root@node5 ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2020-12-17 16:26:05 CST; 7s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 98576 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─98576 /usr/sbin/httpd -DFOREGROUND
├─98577 /usr/sbin/httpd -DFOREGROUND
├─98578 /usr/sbin/httpd -DFOREGROUND
├─98579 /usr/sbin/httpd -DFOREGROUND
├─98580 /usr/sbin/httpd -DFOREGROUND
└─98581 /usr/sbin/httpd -DFOREGROUND
Dec 17 16:26:05 node5 systemd[1]: Starting The Apache HTTP Server...
Dec 17 16:26:05 node5 httpd[98576]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.110.184. Set the 'ServerName' directive globally to su...ss this message
Dec 17 16:26:05 node5 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
#檢視Apache版本
[root@node5 ~]# httpd -version
Server version: Apache/2.4.6 (CentOS)
Server built: Nov 16 2020 16:18:20
```
3.檢視IP地址,訪問Apache頁面
```shell
#可以看到本機IP地址為192.168.110.184
[root@node5 soft]# ifconfig
ens33: flags=4163