应用层:http,https
实现某类具体应用:C/S
传输层协议:TCP,UDP,SCTP
IANA:
0-1023:众所周知,永久地分配给固定的应用使用,特权端口;
如:53/tcp
1024-41951:意为注册端口,但要求不是特别严格,分配给程序注册为某应用使用;3306/tcp,11211/tcp
41952+:客户端程序随机使用的端口,动态端口或私有端口,其范围定义在/proc/sys/net/ipv4/ip_local_port_range中
BSD Socket: IPC的一种实现,允许位于不同主机(也可以是同一主机)上的进程之间进行通信;
Socket API( 封装了内核中的socket通信相关的系统调用)
curl -I
elinks
ab:压力测试
-n 总请求数
-c 模拟并发数
-k 以持久连接模式测试
ab -c 10 -n 1000 URL
安装httpd-2.4
依赖于apr-1.4+,apr-util-1.4+, apr-iconv
apr:apache portable runtime 可移植运行环境
Centos6:
默认:apr-1.3.9 apr-util-1.3.9
编译安装步骤:
1. apr1.4+
2. apr-util-1.4+
3. httpd-2.4
开发环境包组:
[root@rhel6 yum.repos.d]# yum groupinstall "Development Tools" "Server Platform Development" -y
开发程序包:[root@rhel6 yum.repos.d]# yum -y install pcre-devel
service httpd stop
chkocnfig httpd off
上传tar包
[root@rhel6 ~]# tar xf apr-1.5.0.tar.bz2
[root@rhel6 apr-1.5.0]# ./configure --prefix=/usr/local/apr
[root@rhel6 apr-1.5.0]# cd /usr/local/apr/
[root@rhel6 ~]# tar xf apr-util-1.5.3.tar.bz2
[root@rhel6 ~]# cd apr-util-1.5.3
[root@rhel6 apr-util-1.5.3]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@rhel6 httpd-2.4.9]# ./configure --prefix=/usr/local/apache24 --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --
enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-
modules=most --enable-mpms-shared=all --with-mpm=prefork && make && make install
如果卸载,直接运行 make clean
自带的服务控制脚本 apachectl
[root@rhel6 ~]# cd /usr/local/apache24/bin/
[root@rhel6 bin]# ls
ab checkgid envvars-std htdbm httpd rotatelogs
apachectl dbmmanage fcgistarter htdigest httxt2dbm
apxs envvars htcacheclean htpasswd logresolve
[root@rhel6 bin]# /usr/local/apache24/bin/apachectl start
AH00557: httpd: apr_sockaddr_info_get() failed for rhel6.example.com
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName'
directive globally to suppress this message
[root@rhel6 bin]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 :::49864 :::*
LISTEN 0 128 :::111 :::*
LISTEN 0 128 *:111 *:*
LISTEN 0 128 :::80 :::*
LISTEN 0 5 192.168.122.1:53 *:*
LISTEN 0 128 :::22 :::*
LISTEN 0 128 *:22 *:*
LISTEN 0 128 127.0.0.1:631 *:*
LISTEN 0 128 ::1:631 :::*
LISTEN 0 128 *:53111 *:*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 100 127.0.0.1:25 *:*
[root@rhel6 ~]# echo "export PATH=/usr/local/apache24/bin:$PATH" > /etc/profile.d/httpd.sh
[root@rhel6 ~]# echo $PATH
/usr/local/apache24/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
ln -sv /usr/local/apache24/include /usr/include/httpd
[root@rhel6 ~]# cd /etc/rc.d/init.d/
[root@rhel6 init.d]# cp httpd httpd24
[root@rhel6 init.d]# vim httpd24
删除25行的if内容
修改38行路径apachectl=/usr/local/apache24/bin/apachectl
修改39行路径 httpd=${HTTPD-/usr/local/apache24/bin/httpd}
修改41-42行
pidfile=${PIDFILE-/usr/local/apache24/logs/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd24}
[root@rhel6 init.d]# chkconfig --add httpd24
[root@rhel6 init.d]# chkconfig --list httpd24
httpd24 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭
[root@rhel6 init.d]# service httpd24 restart
停止 httpd: [确定]
正在启动 httpd:AH00557: httpd: apr_sockaddr_info_get() failed for rhel6.example.com
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName'
directive globally to suppress this message
[确定]