在accept()调用后是否拾取虚拟主机根目录?
文件在accept()调用后是否拾取虚拟主机根目录?,c,apache,sockets,C,Apache,Sockets,文件/etc/Apache2/sites available/000 default.conf # Ensure that Apache listens on port 80 Listen 80 <VirtualHost *:80> DocumentRoot "/www/example1" ServerName www.example.com # Other directives here </VirtualHost> <VirtualH
/etc/Apache2/sites available/000 default.conf
# Ensure that Apache listens on port 80
Listen 80
<VirtualHost *:80>
DocumentRoot "/www/example1"
ServerName www.example.com
# Other directives here
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/www/example2"
ServerName www.example.org
# Other directives here
</VirtualHost>
#确保Apache侦听端口80
听80
DocumentRoot“/www/example1”
服务器名www.example.com
#这里还有其他指示
DocumentRoot“/www/example2”
服务器名www.example.org
#这里还有其他指示
二进制
apache2
将监听,类似于,listen(listenFD,5)
listenFD
应该如下所示:
retval=bind(listenFD,(struct sockaddr*)&servaddr,sizeof(servaddr))代码>
其中servaddr.sin_port=htons(80)代码>
使用给定的accept()
调用语法
connfd=accept(listenFD,(struct sockaddr*)&cliaddr,&clilen)代码>
问题:
httpd
服务器是否在accept()
调用之后决定选择相应虚拟主机的DocumentRoot
?虚拟主机是否选择应用层逻辑?在服务器解析主机:
HTTP头字段之前,无法解析虚拟主机,该字段显然位于接受()之后
并且在连接的套接字上读取了一定量的数据之后。在服务器解析主机:
HTTP头字段之前,无法解析虚拟主机,这显然是在接受()之后
并且在连接的套接字上读取了一定量的数据之后。YupHost
请求头中的字段定义具有虚拟主机信息YupHost
请求头中的字段定义具有虚拟主机信息