91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Apache-2.2.32安裝配置

發布時間:2020-06-30 07:24:36 來源:網絡 閱讀:496 作者:茁壯的小草 欄目:建站服務器

Apache-2.2.32安裝配置

 

一、Apache服務安裝

 

1.創建目錄,下載Apache源碼包

[root@apache ~]# mkdir/home/wangning/tools -p

[root@apache ~]# cd/home/wangning/tools

[root@apache tools]# wgethttp://mirror.bit.edu.cn/apache/httpd/httpd-2.2.32.tar.gz

 

2.解壓,安裝Apache

[root@apache tools]# tar zxvfhttpd-2.2.32.tar.gz

[root@apache tools]# cdhttpd-2.2.32

[root@apache httpd-2.2.32]# yum-y install zlib zlib-devel   ###安裝zlib依賴包

[root@apache httpd-2.2.32]#./configure --prefix=/application/apache2.2.32 --enable-deflate --enable-expires--enable-headers --enable-modules=most --enable-so --with-mpm=worker--enable-rewrite

[root@apache httpd-2.2.32]#make

[root@apache httpd-2.2.32]#make install

[root@apache httpd-2.2.32]# ln-s  /application/apache2.2.32//application/apache

 

3.檢查語法,啟動Apache服務,兩種啟動方法

[root@apache httpd-2.2.32]#/application/apache/bin/apachectl -t

[root@apache httpd-2.2.32]#/application/apache/bin/apachectl start ###啟動Apache服務

httpd: apr_sockaddr_info_get()failed for apache(報錯1

httpd: Could not reliablydetermine the server's fully qualified domain name, using 127.0.0.1 forServerName(報錯2

[root@apache httpd-2.2.32]#/application/apache/bin/httpd -k start ###啟動Apache服務

hosts文件里添加×××部分,報錯1消除

[root@apache ~]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4localhost4.localdomain4

::1         localhost localhost.localdomainlocalhost6 localhost6.localdomain6

10.0.0.20   apache

在配置文件里添加×××部分,報錯2消除

[root@apache ~]# grepServerName /application/apache/conf/httpd.conf           

# ServerName gives the name andport that the server uses to identify itself.

#ServerName www.example.com:80

ServerName 127.0.0.1:80

 

4.檢查Apache服務是否正常啟動

[root@apache httpd-2.2.32]#lsof -i:80

[root@apache httpd-2.2.32]# ps-ef|grep httpd

[root@apache httpd-2.2.32]#curl  127.0.0.1      ###測試瀏覽器是否可以訪問

<html><body><h2>Itworks!</h2></body></html>

 

二、Apache服務器的首頁,結構目錄和虛擬主機配置

 

1.默認首頁所在的目錄,默認首頁為index.html

[root@apache htdocs]# pwd

/application/apache/htdocs

2.修改默認首頁為wangning.html,×××為增加的內容

[root@apache conf]# grepDirectoryIndex /application/apache/conf/httpd.conf

# DirectoryIndex: sets the filethat Apache will serve if a directory

DirectoryIndex wangning.html index.html

[root@apache htdocs]# touch/application/apache/htdocs/wangning.html

[root@apache htdocs]# echo"www.wangning.com" >/application/apache/htdocs/wangning.html

[root@apache htdocs]# ls/application/apache/htdocs

index.html  wangning.html

[root@apache htdocs]#/application/apache/bin/apachectl -t

[root@apache htdocs]# /application/apache/bin/apachectl  graceful

[root@apache htdocs]# curl10.0.0.20      ###測試修改首頁成功

www.wangning.com

 

3.當默認首頁不存在的時候,Apache服務默認會在瀏覽器頁面顯示目錄結構

[root@apache htdocs]# cd/application/apache/htdocs/

[root@apache htdocs]# mv index.htmlindex.html.bak

在瀏覽器中輸入Apache服務器地址,默認是顯示目錄結構的

Apache-2.2.32安裝配置

在配置文件中Indexes前面加上一個減號,或者將  Indexex刪掉,就不顯示目錄結構了

[root@apache htdocs]# grep -B 13"Options Indexes FollowSymLinks" /application/apache/conf/httpd.conf

<Directory"/application/apache2.2.32/htdocs">

    #

    # Possible values for the Options directiveare "None", "All",

    # or any combination of:

    #  Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

    #

    # Note that "MultiViews" must benamed *explicitly* --- "Options All"

    # doesn't give it to you.

    #

    # The Options directive is both complicatedand important.  Please see

    #http://httpd.apache.org/docs/2.2/mod/core.html#options

    # for more information.

    #

    Options -Indexes FollowSymLinks

[root@apache htdocs]# /application/apache/bin/apachectl  -t

[root@apache htdocs]#/application/apache/bin/apachectl gracefulApache-2.2.32安裝配置

這樣就不顯示目錄結構了

 

4.配置Apache服務器的虛擬主機(基于域名、端口號、ip

1)        基本信息如下

域名

站點目錄

www.wangning.com

/var/html/www

bbs.wangning.com

/var/html/bbs

blog.wangning.com

/var/html/blog

 

2)創建站點目錄

[root@apache /]# mkdir/var/html/{www,bbs,blog}  -p

[root@apache /]# for n in wwwbbs blog;do echo "http://$n.wangning.com">/var/html/$n/index.html;done      ###在這三個目錄里分別創建一個index.html文件,并寫入三個網址

[root@apache /]# for n in wwwbbs blog;do cat /var/html/$n/index.html;done

http://www.wangning.com

http://bbs.wangning.com

http://blog.wangning.com

3)在虛擬主機配置文件末尾增加以下內容,并把文件里兩個默認的虛擬主機樣例刪掉

[root@apache /]# cat/application/apache/conf/extra/httpd-vhosts.conf

<VirtualHost *:80>

    ServerAdmin 1198143315@qq.com

    DocumentRoot "/var/html/www"

    ServerName www.wangning.com

    ServerAlias wangning.com

    ErrorLog "logs/www-error_log"

    CustomLog "logs/www-access_log"common

</VirtualHost>

 

<VirtualHost *:80>

    ServerAdmin 1198143315@qq.com

    DocumentRoot "/var/html/bbs"

    ServerName bbs.wangning.com

    ErrorLog "logs/bbs-error_log"

    CustomLog "logs/bbs-access_log"common

</VirtualHost>

 

<VirtualHost *:80>

    ServerAdmin 1198143315@qq.com

    DocumentRoot "/var/html/blog"

    ServerName blog.wangning.com

    ErrorLog "logs/blog-error_log"

    CustomLog "logs/blog-access_log"common

</VirtualHost>

4)配置Apache的主配置文件httpd.conf,將×××部分內容前的注釋符井號去掉

[root@apache /]# egrep -C 1 "Virtualhosts|httpd-mpm.conf" /application/apache/conf/httpd.conf 

# Server-pool management (MPMspecific)

Include conf/extra/httpd-mpm.conf

 

--

 

# Virtual hosts

Include conf/extra/httpd-vhosts.conf

Apache主配置文件httpd.conf末尾添加如下內容

<Directory"/var/html">

    Options -Indexes FollowSymLinks

    AllowOverride None

    Order allow,deny

    Allow from all

</Directory>

[root@apache /]#/application/apache/bin/apachectl  -t

[root@apache /]#/application/apache/bin/apachectl graceful

 

5)配置Linuxwindows本地hosts文件

linuxhosts文件

[root@apache /]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4localhost4.localdomain4

::1         localhost localhost.localdomainlocalhost6 localhost6.localdomain6

10.0.0.20   apache

10.0.0.20  www.wangning.com bbs.wangning.com blog.wangning.com

WindowsC:\Windows\System32\drivers\etc\hosts文件

# localhost name resolution ishandled within DNS itself.

#       127.0.0.1      localhost

#       ::1            localhost

10.0.0.20 www.wangning.com bbs.wangning.comblog.wangning.com

 

6)最后在windows的瀏覽器里分別訪問三個域名,大功告成了^*^

Apache-2.2.32安裝配置Apache-2.2.32安裝配置Apache-2.2.32安裝配置

 

三、Apache服務器的日志格式配置

1.日志格式分為兩種:

通用日志格式(CommonLog  Format

組合日志格式(CombinedLog  Format

默認是通用格式,一般工作中習慣用組合日志

2.設置三臺虛擬主機的日志格式為組合模式

httpd-vhosts.confcommon都改為combined即可

[root@apache ~]# cat /application/apache/conf/extra/httpd-vhosts.conf

<VirtualHost *:80>

    ServerAdmin 1198143315@qq.com

    DocumentRoot "/var/html/www"

    ServerName www.wangning.com

    ServerAlias wangning.com

    ErrorLog "logs/www-error_log"

    CustomLog "logs/www-access_log" combined

</VirtualHost>

 

<VirtualHost *:80>

    ServerAdmin 1198143315@qq.com

    DocumentRoot "/var/html/bbs"

    ServerName bbs.wangning.com

    ErrorLog "logs/bbs-error_log"

    CustomLog "logs/bbs-access_log" combined

</VirtualHost>

 

<VirtualHost *:80>

    ServerAdmin 1198143315@qq.com

    DocumentRoot "/var/html/blog"

    ServerName blog.wangning.com

    ErrorLog "logs/blog-error_log"

    CustomLog "logs/blog-access_log" combined

</VirtualHost>

 

四、Apache服務器的日志輪詢配置

1.Apache日志輪詢工具有兩種,一種是Apache自帶的輪詢工具rotatelog,另一種是第三方日志輪詢工具cronolog。一般工作中采用第三方工具cronologApache自帶的rotatelog工具之前有過丟日志的情況,所以就一直延續用第三方cronolog日志工具

2.下載并編譯安裝日志輪詢cronolog工具

[root@apache tools]# wgethttp://down1.chinaunix.net/distfiles/cronolog-1.6.2.tar.gz

[root@apache tools]# tar zxvfcronolog-1.6.2.tar.g

[root@apache tools]# cdcronolog-1.6.2

[root@apache cronolog-1.6.2]#./configure

[root@apache cronolog-1.6.2]#make

[root@apache cronolog-1.6.2]#make install

安裝完后會生成一個cronolog命令

[root@apache cronolog-1.6.2]#ls /usr/local/sbin/cronolog

/usr/local/sbin/cronolog

 

3.配置httpd-vhosts.conf文件,以blog.wangning.com虛擬主機為例配置,讓access_log日志輪詢(注意日志路徑要寫絕對路徑)

[root@apache /]# cat/application/apache/conf/extra/httpd-vhosts.conf

<VirtualHost *:80>

    ServerAdmin 1198143315@qq.com

    DocumentRoot "/var/html/blog"

    ServerName blog.wangning.com

    ErrorLog "logs/blog-error_log"

    CustomLog "|/usr/local/sbin/cronologapp/logs/blog-access_%Y%m%d.log" combined

</VirtualHost>

[root@apache /]# ls /app/logs/           ###顯示配置成功

blog-access_20170528.log  blog-access_20170627.log

 

五、Apache服務器的版本號隱藏配置

1.將full改為Prodon改為off

[root@apache ~]# egrep"ServerTokens|ServerSignature"  /application/apache/conf/extra/httpd-default.conf

# ServerTokens

ServerTokens Prod

ServerSignature off

 

2.將×××那行前的注釋符井號去掉

[root@apache ~]# grep "Includeconf/extra/httpd-default.conf" /application/apache2.2.32/conf/httpd.conf

Include conf/extra/httpd-default.conf

 

3.檢查語法,重新加載Apache服務,測試已無版本號了

[root@apache ~]#/application/apache/bin/apachectl -t

[root@apache ~]#/application/apache/bin/apachectl graceful

[root@apache ~]# curl -Iwww.wangning.com           

HTTP/1.1 200 OK

Date: Tue, 27 Jun 2017 14:24:45GMT

Server: Apache

Last-Modified: Sat, 27 May 201715:52:29 GMT

ETag:"82fa4-18-5508370f3e458"

Accept-Ranges: bytes

Content-Length: 24

Content-Type: text/html

 


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

哈尔滨市| 华安县| 五指山市| 仲巴县| 揭西县| 日喀则市| 大邑县| 凤庆县| 贺兰县| 延长县| 武冈市| 辽阳市| 多伦县| 蓝田县| 淮阳县| 嘉黎县| 桐城市| 武隆县| 淄博市| 金山区| 台南县| 乾安县| 登封市| 弥勒县| 五家渠市| 三门县| 库尔勒市| 平泉县| 澜沧| 清镇市| 庆阳市| 涿州市| 即墨市| 德州市| 肥东县| 泰和县| 如东县| 依安县| 南和县| 涟源市| 红安县|