worker321 发表于 2018-11-19 13:39:07

Linux Apache wed服务器

  http服务软件及企业实战
主流web软件
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
当前互联网主流的wed服务说明
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
apache
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
nginx
  (nginx.org)
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
resin
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
tomcat
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
php
  (http://php.net/downloads.php)
linux系统软件包安装方式
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
apache介绍
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
特点及应用场合
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
apache
  安装软件
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
# rpm -qa httpd         =è查看软件
httpd-2.2.15-53.el6.centos.x86_64
# hostname httpd
# logout
#
# 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
安装的步骤:
1032rz –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 dependencies
checking for zlib location... notfound
checking whether to enable mod_deflate... configure: error: mod_deflate has beenrequested but can not be built due to prerequisite failures
解决
# yuminstall zlib zlib-devel –y
##############################################################################################################
执行: yum install zlibzlib-devel –y,再进行编译
1041echo $?==========检查0表示成功
1043make && make install
1045echo $?
1046ln -s/application/apache2.2.27/ /application/apache
# /application/apache/bin/apachectl–t      =====检查apache服务
httpd: apr_sockaddr_info_get() failed for httpd
httpd: Could not reliably determine the server's fully qualified domainname, using 127.0.0.1 for ServerName
Syntax OK         ===语法ok
#
# /application/apache/bin/apachectlstart       ===========开启apache服务
httpd: apr_sockaddr_info_get() failed for httpd
httpd: Could not reliably determine the server's fully qualified domainname, using 127.0.0.1 for ServerName
# lsof-i :80      端口号80            ============检查端口
COMMANDPID   USERFD   TYPE DEVICE SIZE/OFF NODENAME
httpd   6326   root   4uIPv664842   0t0TCP *:http (LISTEN)
httpd   6328 daemon    4u IPv664842      0t0 TCP *:http (LISTEN)
httpd   6329 daemon    4u IPv664842      0t0 TCP *:http (LISTEN)
httpd   6330 daemon    4u IPv664842      0t0 TCP *:http (LISTEN)
# ps-ef|grep httpd=========进程
root      6326   1001:11 ?      00:00:00/application/apache2.2.27/bin/httpd -k start
daemon    63276326001:11 ?      00:00:00 /application/apache2.2.27/bin/httpd-k start
daemon    63286326001:11 ?      00:00:00/application/apache2.2.27/bin/httpd -k start
daemon    63296326001:11 ?      00:00:00/application/apache2.2.27/bin/httpd -k start
daemon    63306326001:11 ?      00:00:00/application/apache2.2.27/bin/httpd -k start
root      64142344001:11 pts/0    00:00:00 grep --color=autohttpd
#
# /etc/init.d/iptablesstop
iptables: Setting chains to policy ACCEPT: filter         
iptables: Flushing firewall rules:                        
iptables: Unloading modules:                              
# getenforce
Disabled
#ifconfigeth0|grep "inet addr"|awk -F ":" '{print $2}'|awk'{print $1}'
192.168.21.168
检查apache安装成功?
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  至此软件安装完毕!!!!!
# curl-I 192.168.21.128
HTTP/1.1 200 OK
Date: Wed, 06 Jul 2016 19:24:29 GMT
Server: Apache/2.2.27 (Unix) DAV/2
Last-Modified: Sat, 20 Nov 2004 20:16:24 GMT
ETag: "258e3-2c-3e9564c23b600"
Accept-Ranges: bytes
Content-Length: 44
Content-Type: text/html
前面编译的:
# /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
# strace/application/apache/bin/apachectl –I======跟踪进程命令()
execve("/application/apache/bin/apachectl",["/application/apache/bin/apachect"..., "-I"], [/* 26 vars*/]) = 0
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
安装软件出现的问题
  1.
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  解决:将写好的编译放在rules.mk即可。
  2.
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  解决:
http://blog.51cto.com/e/u261/themes/default/images/spacer.gifhttp://blog.51cto.com/e/u261/themes/default/images/spacer.gif
apache及目录结构
# tree /application/apache
/application/apache
├── bin
│   ├── ab
│   ├── apachectl
│   ├── apr-1-config
│   ├── apu-1-config
│   ├── apxs
│   ├── checkgid
│   ├── dbmmanage
│   ├── envvars
。。。。。。。。
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
配置文件的目录
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
默认apache站点目录
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
服务很关键的步骤:检查语法,平滑重启
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
主配置文件目录


  重要扩张配置文件
# ll
total 56
-rw-r--r-- 1 root root2859 Jul7 00:44 httpd-autoindex.conf
-rw-r--r-- 1 root root1753 Jul7 00:44 httpd-dav.conf
-rw-r--r-- 1 root root2344 Jul 7 00:44 httpd-default.conf了解
-rw-r--r-- 1 root root1103 Jul7 00:44 httpd-info.conf
-rw-r--r-- 1 root root5078 Jul7 00:44 httpd-languages.conf
-rw-r--r-- 1 root root   949 Jul7 00:44 httpd-manual.conf
-rw-r--r-- 1 root root3789 Jul 7 00:44 httpd-mpm.conf重点
-rw-r--r-- 1 root root2207 Jul7 00:44 httpd-multilang-errordoc.conf
-rw-r--r-- 1 root root 11530 Jul700:44 httpd-ssl.conf
-rw-r--r-- 1 root root   817 Jul7 00:44 httpd-userdir.conf
-rw-r--r-- 1 root root1507 Jul 7 00:44 httpd-vhosts.conf重点
#
便于寻找目录
# cd /application/apache
# ls
bin    cgi-binerroricons    lib   man    modules
buildconf   htdocs includelogsmanual
# cd conf/
# cdextra/
#
创建站点
  一台主机上有不同的站点
# mkdir/var/html/{www,blog,bbs} -p
# tree /var/html/
/var/html/
├── bbs
├── blog
└── www

3 directories, 0 files
#
# touch/var/html/{www,blog,bbs}/index,html
# tree /var/html/
/var/html/
├── bbs
│   └── index,html
├── blog
│   └── index,html
└── www
    └── index,html

3 directories, 3 files
# forname in www blog bbs;do echo "http://$name.etiantian.org">/var/html/$name/index.html;done
# for name in www bolg bbs;do cat/var/html/$nama/index.html;done
http://bbs.etiantian.org
http://bbs.etiantian.org
http://bbs.etiantian.org
# vim httpd-vhosts.conf

    ServerAdmin 813415154@qq.com   管理员邮箱
    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   站点访问日志


http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  注意的问题:
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif

  apache
  apache日志轮询技术(cronolog【一般企业常用】 and rotatelogs)
# wget http://cronolog.org/download/cronolog-1.6.2.tar.gz
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
apache的轮巡
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  (http://oldboy.blog.51cto.com/2561410/584513)老男孩日志轮巡技术
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
隐藏版本及apache的版本信息
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
生产环境常见的http状态码列表
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  




页: [1]
查看完整版本: Linux Apache wed服务器