浏览 1477 次
锁定老帖子 主题:ubuntu下使用xinetd
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2013-02-27
标准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\r\n" /bin/echo -e "Content-Type: Content-Type: text/plain\r\n" /bin/echo -e "\r\n" /bin/echo -e "hello xinetd\r\n" /bin/echo -e "\r\n" 修改脚本权限(给user执行权限) chmod 755 /etc/xinetd.d/httpok 【创建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/ 【参考文章】 http://sopace.blog.51cto.com/1227753/324142 http://blog.chinaunix.net/uid-21411227-id-1826885.html 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |