您当前的位置: 首页 > 学无止境 > 网站建设 网站首页网站建设
apache在控制台中的常用命令
发布时间:2015-10-17 07:45:51编辑:雪饮阅读()
进入httpd进程所在目录:
httpd.exe -k start启动
Httpd.exe -k shutdown停止
Httpd.exe -k restart重启
一台电脑总共有65535个端口
在实际开发中,我们经常使用netstat -an来查看机器有哪些端口在监听
Netstat -anb命令可以查看到具体是哪个应用程序对应监听哪个端口
Pid:进程号
一台机器的一个80端口被一个apache应用程序监听了之后则不能被其他应用程序监听
端口分为有名端口1-1024,这些端口都已经名花有主了,编程时最好不要用,其它端口可以自行分配
客户端访问服务器端,从客户端向出发送请求的端口号是随机的
而请求进入服务器端的开放端口则是固定的如80端口,客户端发送请求的
端口在请求发送出去之后立即关闭这个客户端端口
当然apache的监听端口是可以更改哦。
在apache的配置文件httpd.conf文件中可以更改端口号,如下为httpd.conf文件更改为81端口后的局部代码:
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 81
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
Httpd.conf文件中“Listen 81”即端口配置语句
配置ok之后要重新启动apache修改方能生效,若是要在控制台中查看监听端口是否改变也要exit控制台之后重新打开控制台查看才可以,否则控制台中也是无法查看更改的生效
当然一个程序也是可以监听多个端口如下httpd.conf配置也是ok的,也可以通过不同端口访问相同的服务器端文件:
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 81
Listen 82
Listen 83
Listen 84
#
# Dynamic Shared Object (DSO) Support
#
关键字词:ahache,控制台
上一篇:php中正则表达式与伪静态
下一篇:apache虚拟目录配置教程
相关文章
-
无相关信息