标签:code tar.gz include .so 版本号 联网 pac 连接数 yum
并发?主流互联网web服务器
静态:
apache、nginx、lighttpd
动态:
IIS(asp、aspx)、tomcat(jsp)、resin(jsp)
php(fcgi)[配合apache,php是一个模块mod_php5.so,不起服务]
安装方式
1、源码编译
cd /usr/local/share/
wget http://mirrors.hust.edu.cn/apache/httpd/httpd-2.2.34.tar.gz
tar -zxvf httpd-2.2.34.tar.gz
cd httpd-2.2.34
./configure --prefix=/application/httpd-2.2.34 --enable-deflate --enable-expires --enable-headers --enable-modules=most --enable-so --with-mpm=worker --enable-rewite
make && make install
2、yum安装
yum install httpd -y
apachectl命令
检查语法
/application/httpd-2.2.34/bin/apachectl -t
查看模块
/application/httpd-2.2.34/bin/apachectl -l
启动
/application/httpd-2.2.34/bin/apachectl start
关闭
/application/httpd-2.2.34/bin/apachectl stop
重启
/application/httpd-2.2.34/bin/apachectl restart
优雅重启
/application/httpd-2.2.34/bin/apachectl graceful
配置文件
/application/httpd-2.2.34/conf/httpd.conf
<Directory "/application/httpd-2.2.34/htdocs">
Options Indexes FollowSymLinks #去掉Indexes以后没有首页的时候就不会展示目录结构
AllowOverride None
Order allow,deny
Allow from all
添加虚拟主机,可以基于域名、端口、ip
vim /application/httpd-2.2.34/conf/httpd.conf去掉注释
Include conf/extra/httpd-vhosts.conf
vi /application/httpd-2.2.34/conf/extra/httpd-vhosts.conf
目录授权
Directory "/application/httpd-2.2.34/docs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
添加虚拟主机
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/application/httpd-2.2.34/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
更改工作模式
vim httpd-mpm.conf
默认是prefork
编译的时候可以指定worker模式
curl查看网站程序版本,所以需要在default.conf 隐藏版本号
curl -I 192.168.56.100
虚拟主机:部署多个站点,每个站点需要用不同的域名,站点目录或者不同的端口,不同的IP。一个http服务要配置多个站点就需要虚拟主机。
让ip地址无法访问网站
设置第一个VirtuaHost,然后给一个rewrite
标签:code tar.gz include .so 版本号 联网 pac 连接数 yum
原文地址:http://blog.51cto.com/13491150/2059094