標籤:apache
這一節說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