20170825L08-05老男孩linux實戰營運培訓-Lamp系列之-Apache服務生產實戰應用指南02

來源:互聯網
上載者:User

標籤: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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.