下边是自己的个人理解如果有问题还请大家指正:
用户通过浏览器访问域名,域名通过DMS服务器解析到IP,浏览器向服务器80端口或者8080端口(HTTP协议使用80/8080端口,HTTPS使用443端口)发起TCP连接请求。
web服务器nginx的虚拟主机server监听80/8080端口,接收到请求以后,可以通过检查‘Host’来判定客户程序请求是哪个虚拟主机的服务,然后在进行下一步的处理。
server
{
listen 80;
server_name local.php.com;
index index.html index.htm index.php
root /data/wwwroot/php/public
}
server_name 的 local.php.com映射到了data/wwwroot/php/public/index.php;
location ~ .php {
fastcgi_index /index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED d o