Linux Apache Wed

http服务软件及企业实战

主流web软件

当前互联网主流的wed服务说明

apache

nginx

(nginx.org)

resin

tomcat

php

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

linux系统软件包安装方式

apache介绍

特点及应用场合

apache

安装软件

[[email protected] ~]# rpm -qa httpd         =è查看软件

httpd-2.2.15-53.el6.centos.x86_64

[[email protected] ~]# hostname httpd

[[email protected] ~]# logout

[[email protected] ~]#

[[email protected] ~]# 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 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

解决

[[email protected] httpd-2.2.27]# yuminstall zlib zlib-devel –y

##############################################################################################################

执行: yum install zlibzlib-devel –y,再进行编译

1041  echo $?  ==========检查  0表示成功

1043  make && make install

1045  echo $?

1046  ln -s/application/apache2.2.27/ /application/apache

[[email protected] 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

[[email protected] apache]#

[[email protected] apache]# /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

[[email protected] apache]# lsof-i :80        端口号80              ============检查端口

COMMAND  PID   USER  FD   TYPE DEVICE SIZE/OFF NODENAME

httpd   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)

[[email protected] apache]# ps-ef|grep httpd  =========进程

root      6326     1  001:11 ?        00:00:00/application/apache2.2.27/bin/httpd -k start

daemon    6327  6326  001:11 ?        00:00:00 /application/apache2.2.27/bin/httpd-k start

daemon    6328  6326  001:11 ?        00:00:00/application/apache2.2.27/bin/httpd -k start

daemon    6329  6326  001:11 ?        00:00:00/application/apache2.2.27/bin/httpd -k start

daemon    6330  6326  001:11 ?        00:00:00/application/apache2.2.27/bin/httpd -k start

root      6414  2344  001:11 pts/0    00:00:00 grep --color=autohttpd

[[email protected] apache]#

[[email protected] apache]# /etc/init.d/iptablesstop

iptables: Setting chains to policy ACCEPT: filter          [  OK  ]

iptables: Flushing firewall rules:                         [  OK  ]

iptables: Unloading modules:                               [  OK  ]

[[email protected] apache]# getenforce

Disabled

[[email protected] apache]#  ifconfigeth0|grep "inet addr"|awk -F ":" ‘{print $2}‘|awk  ‘{print $1}‘

192.168.21.168

检查apache安装成功?

至此软件安装完毕!!!!!

[[email protected] apache]# 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

前面编译的:

[[email protected] 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

[[email protected] 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及目录结构

[[email protected] htdocs]# tree /application/apache

/application/apache

├── bin

│   ├── ab

│   ├── apachectl

│   ├── apr-1-config

│   ├── apu-1-config

│   ├── apxs

│   ├── checkgid

│   ├── dbmmanage

│   ├── envvars

。。。。。。。。

配置文件的目录

默认apache站点目录

服务很关键的步骤:检查语法,平滑重启

主配置文件目录

重要扩张配置文件

[[email protected] extra]# ll

total 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重点

[[email protected] extra]#

便于寻找目录

[[email protected] /]# cd /application/apache

[[email protected] apache]# ls

bin    cgi-bin  error  icons    lib   man    modules

build  conf     htdocs include  logs  manual

[[email protected] apache]# cd conf/

[[email protected] conf]# cd  extra/

[[email protected] extra]#

创建站点

一台主机上有不同的站点

[[email protected] extra]# mkdir/var/html/{www,blog,bbs} -p

[[email protected] extra]# tree /var/html/

/var/html/

├── bbs

├── blog

└── www

3 directories, 0 files

[[email protected] extra]#

[[email protected] extra]# touch/var/html/{www,blog,bbs}/index,html

[[email protected] extra]# tree /var/html/

/var/html/

├── bbs

│   └── index,html

├── blog

│   └── index,html

└── www

└── index,html

3 directories, 3 files

[[email protected] extra]# forname in www blog bbs;do echo "http://$name.etiantian.org">/var/html/$name/index.html;done

[[email protected] extra]# 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

[[email protected] 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)

[[email protected] tools]# wget http://cronolog.org/download/cronolog-1.6.2.tar.gz

apache的轮巡

(http://oldboy.blog.51cto.com/2561410/584513)老男孩日志轮巡技术

隐藏版本及apache的版本信息

生产环境常见的http状态码列表

时间: 2024-11-03 21:14:14

Linux Apache Wed的相关文章

Linux Apache wed服务器

http服务软件及企业实战 主流web软件 当前互联网主流的wed服务说明 apache nginx (nginx.org) resin tomcat php (http://php.net/downloads.php) linux系统软件包安装方式 apache介绍 特点及应用场合 apache 安装软件 [[email protected] ~]# rpm -qa httpd         =è查看软件 httpd-2.2.15-53.el6.centos.x86_64 [[email p

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu

About LAMP LAMP stack is a group of open source software used to get web servers up and running. The acronym stands for Linux, Apache, MySQL, and PHP. Since the virtual private server is already running Ubuntu, the linux part is taken care of. Here i

Ubuntu下(Linux+Apache+MYSQL+PHP, LAMP)环境搭建

最近开始玩PHP,于是试着搭建一下开发环境并做个记录,以备日后再使用起来方便可查. 第一步 确保软件包是最新的 <span style="font-size: 18px;">sudo apt-get update</span> 第二步 安装Apache2 <span style="font-size: 18px;">sudo apt-get install apache2</span> 安装之后测试:在浏览器中打开 h

Lamp(linux+apache+mysql+php)环境搭建

Lamp(linux+apache+mysql+php)环境搭建 1.安装apache2:sudo apt-get installapache2 安装完毕后.执行例如以下命令重新启动apache:sudo/etc/init.d/apache2 restart,在浏览器中输入http://localhost或者http://127.0.0.1,会看到"It works!"说明apache成功安装. 2.安装php:sudoapt-get install libapache2-mod-ph

Linux Apache error 日志 提示[warn] child process 7751 still did not exit, sending a SIGTERM

Apache吃空内存,频繁宕机 在部署一套内网测试环境时,频繁宕机,开机后不断的吃内存,重启apache之后内存占用会不停的上涨,直到swap用完,直到死机,由于是内网环境,服务器并发和压力都很小. 查看apache错误日志,报大量类似错误: [Tue Feb 14 14:49:28 2012] [warn] child process 7751 still did not exit, sending a SIGTERM [Tue Feb 14 14:49:30 2012] [error] ch

linux apache 自动监护脚本

1 首先安装curl yum install curl 2 编写shell vi restart_apache.sh 写入一下内容 #!/bin/bashURL="http://127.0.0.1/"curlit(){curl --connect-timeout 35 --max-time 40 --head --silent "$URL" | grep '200'} doit(){if ! curlit; thensleep 20top -n 1 -b >&

Ubuntu下的LAMP(Linux+Apache+MySQL+PHP) 开发环境架设

LAMP在业界是一个非常流行的词语,这4个字母分别代表Linux,Apache,MySQL和PHP.LAMP以其高效.灵活的特性已经成为中小企业的首选. 以前介绍一种迅速搭建LAMP的方式. 1 在Ubuntu上打开终端,输入 sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server 一口气就可以下载(apache2,php5,mysql)三个工具 2 安装MySQL的时候,会让你设定一个Root管理员的密码

Linux + apache + php + mysql

linux + apache 2.4.4 + php配置 参考文章 参考文章 参考文章

CentOS 6.5下源码安装LAMP(Linux+Apache+Mysql+Php)环境

CentOS 6.5下源码安装LAMP(Linux+Apache+Mysql+Php)环境一. 系统环境:Linux系统版本: CentOS release 6.5Apache版本: httpd-2.2.24PHP 版本: php-5.6.11 二.安装前准备: 1.查看是否安装GCC ,GCC-C++编译器,如果没有则进行安装: 查看是否安装的命令: #gcc –v 若未安装在服务器联网情况下可以使用下列命令安装: #yum install gcc #yum install gcc-c++2.