歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

Linux Apache Wed

http服務軟件及企業實戰

主流web軟件


當前互聯網主流的wed服務說明


apache


nginx

(nginx.org)

resin


tomcat


php

(http://php.net/downloads.php)

linux系統軟件包安裝方式



apache介紹



特點及應用場合


apache

安裝軟件

[root@zyl ~]# rpm -qa httpd =è查看軟件httpd-2.2.15-53.el6.centos.x86_64[root@zyl ~]# hostname httpd [root@zyl ~]# logout[root@httpd ~]# [root@httpd ~]# rpm -e httpd-2.2.15-53.el6.centos.x86_64 =è卸載軟件warning: /etc/httpd/conf/httpd.conf saved as/etc/httpd/conf/httpd.conf.rpmsave安裝的步驟:1032 rz –y ====è我是先將安裝包下載windows 1033 ll 1034 tar -xf httpd-2.2.27.tar.gz 1035 cd httpd-2.2.27 1036 ls 1037 ./configure =====編譯 --prefix=/application/apache2.2.27 --enable-deflate --enable-expires --enable-headers --enable-modules=most --enable-so --with-mpm=worker --enable-rewrite#################################################################################################################遇見錯誤:checking whether to enable mod_deflate... checking dependencieschecking for zlib location... notfoundchecking whether to enable mod_deflate... configure: error: mod_deflate has beenrequested but can not be built due to prerequisite failures解決[root@httpd httpd-2.2.27]# yuminstall zlib zlib-devel –y##############################################################################################################執行: yum install zlibzlib-devel –y,再進行編譯1041 echo $? ==========檢查 0表示成功1043 make && make install1045 echo $?1046 ln -s/application/apache2.2.27/ /application/apache[root@httpd apache]# /application/apache/bin/apachectl–t =====檢查apache服務httpd: apr_sockaddr_info_get() failed for httpdhttpd: Could not reliably determine the server's fully qualified domainname, using 127.0.0.1 for ServerNameSyntax OK ===語法ok[root@httpd apache]#[root@httpd apache]# /application/apache/bin/apachectlstart ===========開啟apache服務httpd: apr_sockaddr_info_get() failed for httpdhttpd: Could not reliably determine the server's fully qualified domainname, using 127.0.0.1 for ServerName[root@httpd apache]# lsof-i :80 端口號80 ============檢查端口COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODENAMEhttpd 6326 root 4u IPv6 64842 0t0 TCP *:http (LISTEN)httpd 6328 daemon 4u IPv6 64842 0t0 TCP *:http (LISTEN)httpd 6329 daemon 4u IPv6 64842 0t0 TCP *:http (LISTEN)httpd 6330 daemon 4u IPv6 64842 0t0 TCP *:http (LISTEN)[root@httpd apache]# ps-ef|grep httpd =========進程root 6326 1 001:11 ? 00:00:00/application/apache2.2.27/bin/httpd -k startdaemon 6327 6326 001:11 ? 00:00:00 /application/apache2.2.27/bin/httpd-k startdaemon 6328 6326 001:11 ? 00:00:00/application/apache2.2.27/bin/httpd -k startdaemon 6329 6326 001:11 ? 00:00:00/application/apache2.2.27/bin/httpd -k startdaemon 6330 6326 001:11 ? 00:00:00/application/apache2.2.27/bin/httpd -k startroot 6414 2344 001:11 pts/0 00:00:00 grep --color=autohttpd[root@httpd apache]# [root@httpd apache]# /etc/init.d/iptablesstopiptables: Setting chains to policy ACCEPT: filter [ OK ]iptables: Flushing firewall rules: [ OK ]iptables: Unloading modules: [ OK ][root@httpd apache]# getenforceDisabled[root@httpd apache]# ifconfigeth0|grep "inet addr"|awk -F ":" '{print $2}'|awk '{print $1}'192.168.21.168檢查apache安裝成功?

至此軟件安裝完畢!!!!!
[root@httpd apache]# curl-I 192.168.21.128HTTP/1.1 200 OKDate: Wed, 06 Jul 2016 19:24:29 GMTServer: Apache/2.2.27 (Unix) DAV/2Last-Modified: Sat, 20 Nov 2004 20:16:24 GMTETag: "258e3-2c-3e9564c23b600"Accept-Ranges: bytesContent-Length: 44Content-Type: text/html前面編譯的:[root@httpd apache]# /application/apache/bin/apachectl -l|egrep"_so|_rewrite|header|expire|deflate" mod_deflate.c mod_expires.c mod_headers.c mod_rewrite.c mod_so.c[root@httpd apache]# strace/application/apache/bin/apachectl –I ======跟蹤進程命令 ()execve("/application/apache/bin/apachectl",["/application/apache/bin/apachect"..., "-I"], [/* 26 vars*/]) = 0

安裝軟件出現的問題

1.

解決:將寫好的編譯放在rules.mk即可。
2.

解決:


apache及目錄結構

[root@httpd htdocs]# tree /application/apache/application/apache├── bin│ ├── ab│ ├── apachectl│ ├── apr-1-config│ ├── apu-1-config│ ├── apxs│ ├── checkgid│ ├── dbmmanage│ ├── envvars。。。。。。。。

配置文件的目錄


默認apache站點目錄


服務很關鍵的步驟:檢查語法,平滑重啟




主配置文件目錄

重要擴張配置文件
[root@httpd extra]# lltotal 56-rw-r--r-- 1 root root 2859 Jul 7 00:44 httpd-autoindex.conf-rw-r--r-- 1 root root 1753 Jul 7 00:44 httpd-dav.conf-rw-r--r-- 1 root root 2344 Jul 7 00:44 httpd-default.conf 了解-rw-r--r-- 1 root root 1103 Jul 7 00:44 httpd-info.conf-rw-r--r-- 1 root root 5078 Jul 7 00:44 httpd-languages.conf-rw-r--r-- 1 root root 949 Jul 7 00:44 httpd-manual.conf-rw-r--r-- 1 root root 3789 Jul 7 00:44 httpd-mpm.conf 重點-rw-r--r-- 1 root root 2207 Jul 7 00:44 httpd-multilang-errordoc.conf-rw-r--r-- 1 root root 11530 Jul 700:44 httpd-ssl.conf-rw-r--r-- 1 root root 817 Jul 7 00:44 httpd-userdir.conf-rw-r--r-- 1 root root 1507 Jul 7 00:44 httpd-vhosts.conf重點[root@httpd extra]#

便於尋找目錄

[root@httpd /]# cd /application/apache[root@httpd apache]# lsbin cgi-bin error icons lib man modulesbuild conf htdocs include logs manual[root@httpd apache]# cd conf/[root@httpd conf]# cd extra/[root@httpd extra]#

創建站點

一台主機上有不同的站點
[root@httpd extra]# mkdir/var/html/{www,blog,bbs} -p[root@httpd extra]# tree /var/html//var/html/├── bbs├── blog└── www 3 directories, 0 files[root@httpd extra]#[root@httpd extra]# touch/var/html/{www,blog,bbs}/index,html[root@httpd extra]# tree /var/html//var/html/├── bbs│ └── index,html├── blog│ └── index,html└── www └── index,html 3 directories, 3 files[root@httpd extra]# forname in www blog bbs;do echo "http://$name.etiantian.org">/var/html/$name/index.html;done[root@httpd extra]# for name in www bolg bbs;do cat/var/html/$nama/index.html;donehttp://bbs.etiantian.orghttp://bbs.etiantian.orghttp://bbs.etiantian.org[root@httpd extra]# vim httpd-vhosts.conf <VirtualHost *:80> ServerAdmin [email protected] 管理員郵箱 DocumentRoot"/var/html/www" 站點 ServerName www.etiantian.com 域名 ServerAlias www..com 別名 ErrorLog"logs/dummy-host.example.com-error_log" 站點的錯誤日志 CustomLog"logs/dummy-host.example.com-access_log" common 站點訪問日志

注意的問題:

apache
apache日志輪詢技術(cronolog【一般企業常用】 and rotatelogs)
[root@httpd tools]# wgethttp://cronolog.org/download/cronolog-1.6.2.tar.gz

apache的輪巡



(/content/3019741.html)老男孩日志輪巡技術





隱藏版本及apache的版本信息



生產環境常見的http狀態碼列表




本文出自 “randolph” 博客,轉載請與作者聯系!
Copyright © Linux教程網 All Rights Reserved