20170825L08-05老男孩linux實戰運維培訓-Lamp系列之-Apache服務生產實戰應用指南02
這一節說Apache的安裝目錄文件
具體介紹了一些重要文件的配置
tree -L 1 /usr/local/apache
[[email protected] extra]# tree -L 1 /usr/local/apache
/usr/local/apache
├── apache -> /usr/local/apache
├── bin
├── build
├── cgi-bin
├── conf
├── error
├── htdocs
├── icons
├── include
├── lib
├── logs
├── man
├── manual
└── modules
bin目錄apache一些重要的命令放在這裏
apachectl 命令是apache啟動,重啟,和停止命令
htdocs主目錄文件位置
[[email protected] apache]# tree htdocs
htdocs
└── index.html
conf文件內都是一些配置文件
[[email protected] apache]# tree -L 1 conf
conf
├── extra
├── httpd.conf
├── magic
├── mime.types
└── original
當然最重要的文件是httpd.conf
log目錄日誌文件存放地址
.
├── access_log
├── error_log
└── httpd.pid
access是訪問日誌
error錯誤日誌
httpd.pid 有apache運行時候的進程id號
modules放模塊的目錄,如編譯php,memcache
講解httpd.conf文件
ServerRoot file #後面接的是apache主安裝文件位置
Listen 80 #用來設定訪問端口的也可以指定IP
Listen 12.88.99.12:80
也可以指定多個端口比如
Listen 80
Listen 88
......
設置用戶組和用戶用來訪問服務
User daemon
Group daemon
ServerAdmin [email protected] #服務器出問題後通知管理員的郵箱設置
ServerName #給服務器設置一個名字
網站的默認頁存放目錄
DocumentRoot "/usr/local/apache2/htdocs"
控制目錄權限的
以下為根目錄權限
<Directory />
AllowOverride none #禁重載
Require all denied #禁示所有限止的訪問
</Directory>
<Directory "/usr/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn‘t give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks #允許瀏覽目錄,為了安全要關閉這個權限
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride None #htaccess可以網站開發人員來參與權限管理,默認是不開的
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
看httpd.conf使用的設置行統計
egrep -v "^.*#|^$" httpd.conf|nl
extra是apache的擴展配置文件目錄
[[email protected] extra]# tree
.
├── httpd-autoindex.conf
├── httpd-dav.conf
├── httpd-default.conf
├── httpd-info.conf
├── httpd-languages.conf
├── httpd-manual.conf
├── httpd-mpm.conf
├── httpd-multilang-errordoc.conf
├── httpd-ssl.conf
├── httpd-userdir.conf
├── httpd-vhosts.conf
└── proxy-html.conf
其中主要說的是httpd-vhosts.conf這上配置文件
這是虛擬主機的配置文件
20170825L08-05老男孩linux實戰運維培訓-Lamp系列之-Apache服務生產實戰應用指南02