【简介】
参考百度百科
http://baike.baidu.com/link?url=nWkyOfMIk_rxHirveSXRc5qiqRxj_-wnFxh5-Pr5qXr9JC8l7TVrv7EWEpH8IsjP
centos在线安装
yum -y install xinetd
【知识点】
标准http响应文件内容
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Length: 0
Date: Wed, 27 Feb 2013 02:34:36 GMT
ubuntu下安装(系统级工具,一般不自定义安装)
apt-get install xinetd
【创建个服务脚本】
/root/shell/httpok.sh
#!/bin/sh
/bin/echo -e "HTTP/1.1 200 OK"
/bin/echo -e "Content-Type: text/plain"
/bin/echo -e "Content-Length: 18"
/bin/echo -e "Connection: close"
/bin/echo -e ""
/bin/echo -e "httpok is running."
/bin/echo -e ""
修改脚本权限(给user可执行权限)
chmod 755 /root/shell/httpok.sh
【创建xinetd服务】
vi /etc/xinetd.d/httpok
service my_httpok
{
flags = REUSE
socket_type = stream
#port = 9201
wait = no
user = root
server = /root/shell/httpok.sh
#log_on_failure += USERID
disable = no
#only_from = 192.168.5.0/24
#recommended to put the IPs that need to connect exclusively (security purposes)
}
【修改端口,方法有2种】
1.默认依赖/etc/services,此时/etc/xinetd.d/httpok这个文件配置的port无效,所以不需要配置
vi /etc/services
my_httpok 9201/tcp
2.解除依赖/etc/services
此时/etc/xinetd.d/httpok这个文件配置里需要加上
type = UNLISTED
port = 9201
【重启服务,测试端口访问】
service xinetd restart
curl http://127.0.0.1:9201/
【参考文章】
这2篇文章写的特别好,非常值得看
http://sopace.blog.51cto.com/1227753/324142
http://blog.chinaunix.net/uid-21411227-id-1826885.html
ubuntu/centos下使用xinetd
猜你喜欢
转载自phl.iteye.com/blog/1815778
今日推荐
周排行