apache,apache官網

來源:互聯網
上載者:User

apache,apache官網

yum install httpd\* -yiptables -I INPUT 1 -p tcp --dport 80 -j ACCEPTservice iptables save 
1 vim /etc/httpd/conf/httpd.conf2 3 ServerTokens OS                   //顯示版本號碼4 ServerRoot "/etc/httpd"           //預設路徑5 PidFile run/httpd.pid             //進程ID6 Timeout 120                       //連線逾時時間7 KeepAlive Off                     //是否保持啟用(傳輸多個檔案時不用重複進行三向交握)8 MaxKeepAliveRequests 100          //保持串連傳輸檔案的最大數量9 KeepAliveTimeout 15               //保持串連的最長時間15秒
1 <IfModule prefork.c>  2  StartServers       8             //伺服器啟動的時候開啟多少個空閑進程  3  MinSpareServers    5             //最少空前進程,隨時保證有至少5個空閑進程接受使用者請求  4  MaxSpareServers   20             //最大空閑進程,最多保留20個,多了就浪費資源  5  ServerLimit      256             //  最多請求串連不得超過次數,這是上限值,如果想調大必須先關閉服務然後才能調  6  MaxClients       256             //  最多運行多少個請求串連  7  MaxRequestsPerChild  4000        //每一進程最多能響應多少次請求,如果達到此值將被殺掉,重開新進程  8  </IfModule> 
1 Listen 80                         //預設監聽的連接埠號碼2 Include conf.d/*.conf             // 將conf.d目錄下尾碼為.conf的檔案都載入進來3 User apache                       //設定預設的使用者4 Group apache                      // 設定預設的組5 ServerAdmin root@localhost        //管理員郵箱6 ServerName www.example.com:80     //佈建網站網域名稱7 DocumentRoot "/var/www/html"      //設定預設網頁目錄,預設為index.html檔案
1 <Directory "/var/www/html">2     Options Indexes FollowSymLinks3     AllowOverride None4       Order allow,deny            //逗號後邊的為預設5       Allow from all              // 發生衝突使,以預設為準6       deny from all 7 </Directory>
1 Options                           //定義<Directory "/var/www/html">目錄中所有網頁檔案能夠被訪問時的訪問屬性  2    None                           // 不支援任何選項  3    all                            //  啟用所有選項  4    Indexes                        // 允許索引目錄,當預設目錄沒有index.html檔案時,會將目錄中所有檔案列出來。5    FollowSymLinks                 //允許符號連結指向的源檔案,也就是軟串連6    ExecCGI                        //允許運行cgi 指令碼 
1 <IfModule mod_userdir.c>         //  如果安裝了此模組則支援使用者是否能在家目錄下建立網頁2  UserDir disable                 // 開啟說明禁止使用者建立家目錄3  UserDir public_html             // 開啟說明運行使用者在家目錄下建立4 注意 在/home/user1/ 下建立public_html 如果不能查看 查看布爾值 httpd_enable_homedirs
 1 DirectoryIndex index.html index.html.var  //預設訪問的檔案名稱和順序 2  3 <Directory "/var/www/jiami"> 4 AllowOverride   AuthConfig       //加密訪問 5 </Directory> 6  7 使用使用者名稱和密碼方式實現驗證登入 8 ①進入需要實現驗證的檔案夾裡面建立一個 .htaccess 檔案 9 vim .htaccess10  11 AuthName   xxxx                  //定義受保護領域的名稱12 AuthName   Basic                 //定義認證的方式13 AuthName  /var/www/html/.htpasswd  // 指定認證口令檔案的位置14 Require user xxx                 // 授權給指定的使用者15 在改路徑下建立 .htpasswd 認證口令檔案16 htpasswd -cm .htpasswd 使用者名稱  根據提示輸入密碼17 18 Alias /icons/ "/var/www/icons/"  // 別名設定
 1 虛擬機器主機設定: 2  3 基於主機名稱 4  5 NameVirtualHost *:80 6 <VirtualHost *:80> 7 DocumentRoot /var/www/html        // 不加雙引號的時候 是絕對路徑,加了就是相對路徑 8 ServerName www.sangmu.com         //網域名稱 9 <location>10 order allow,deny11 deny from all12 allow from 192.168.10.1413 </location>14 </VirtualHost>15 16 <VirtualHost *:80>17 DocumentRoot /var/www/html   18 ServerName www.sangmu1.com     19 </VirtualHost>
 1 基於IP 2 NameVirtualHost *:80    需要將這個注釋掉 3 <VirtualHost 192.168.10.14:80> 4 DocumentRoot /var/www/html      5 ServerName www.sangmu.com      6 </VirtualHost> 7  8 <VirtualHost 192.168.10.141:80> 9 DocumentRoot /var/www/html       10 ServerName www.sangmu.com       11 </VirtualHost>12 13 添加ip地址14 ①添加ip地址: ip addr add 192.168.10.141/24 dev eth0 label eth0:115 ②設定檔 cp -p ifcfg-eth0 ifcfg-eth0:116 ③對設定檔修改 並重啟網卡
 1 基於連接埠 2  3 添加監聽的連接埠:listen 8080 並配置防火牆 4 添加 namevirtualhost *:8080 5  6 <VirtualHost *:80> 7 DocumentRoot /var/www/html     8 ServerName www.sangmu.com       9 </VirtualHost>10 11 <VirtualHost *:8080>12 DocumentRoot /var/www/html     13 ServerName www.sangmu.com       14 </VirtualHost>

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.