跳轉到內容

Apache/配置

來自華夏公益教科書,開放的書籍,面向開放的世界

配置 Apache Web 伺服器


GUI 工具

有一些 GUI 工具可以配置 Apache Web 伺服器,但它們大多隻執行基本或中級配置。對於高階配置,修改配置檔案是最佳選擇。一些 GUI 工具包括:Comanche、TkApache、LinuxConf、WebMin、ApacheConf、user_manage。其中,Webmin 是基於瀏覽器的,可能比其他工具更好。

基本 Apache 配置資訊如下

Apache 有三個配置檔案

httpd.conf
access.conf
srm.conf

httpd.conf 是主檔案,您可以忽略其他檔案。

一個基本的配置檔案可能如下所示

 ServerName www.justetc.net #host name .. serving website URL
 listen 192.168.0.1:80 # listen to the network interface 192.168.0.1 and port 80
 listen 192.168.0.1:400 # listen to the network interface 192.168.0.1 and port 400
 User nobody #connect to the apache server as the user nobody #default
 Group nobody
 ServerAdmin admin@justetc.net #email of the administrator
 ServerRoot /usr/locale/apache #apache's main working folder, apache keeps essential files here
 ErrorLog logs/error_log #to keep track of errors
 TransferLog logs/access_log #check the access, may make website slower
 DocumentRoot /home/www/justetc

您可以建立自己的使用者並將其設定為訪問網頁

groupadd -g httpd
useradd -u 999 -g httpd -s /bin/false -c 'Web Server'

然後使用

User httpd
Group httpd
華夏公益教科書