后端基础知识6. • http://meituan.com
• hosts
7. • http://meituan.com
• hosts
• localhost 127.0.0.1
10. Mail Client
Web Browser hosts
cache 1-30mins
Clients Programs
Your Computer
11. Mail Client
Web Browser hosts DNS Resolver
cache 1-30mins
local cache
Clients Programs
Your Computer
12. Mail Client
Web Browser hosts DNS Resolver
cache 1-30mins
local cache
Clients Programs
Your Computer
17. Local Name Server / Your ISP Root Name Server
2
3
Com Name Server
1
Your Computer
18. Local Name Server / Your ISP Root Name Server
2
3
Com Name Server
1
Your Computer
19. Local Name Server / Your ISP Root Name Server
2
3
Com Name Server
4
Meituan Name Server
1
Your Computer
20. Local Name Server / Your ISP Root Name Server
2
3
Com Name Server
4
Meituan Name Server
1
Your Computer
21. Local Name Server / Your ISP Root Name Server
2
3
Com Name Server
4
Meituan Name Server
1 5
Your Computer
22. Local Name Server / Your ISP Root Name Server
2
3
Com Name Server
4
Meituan Name Server
1 5
6
Your Computer Meituan Web Server
34. • 301 Moved Permanently
• 302 Moved Temporarily
• 304 Not Modified
• 401 Unauthorized
• 403 Forbidden
• 502 Bad Gateway
35. Request Headers
• Host: www.meituan.com
• User-Agent:Mozilla/5.0 (Macintosh; Intel
Mac OS X 10.6; rv:2.0.1) Gecko/20100101
Firefox/4.0.1
37. Response Headers
• Server: nginx
• Date: Mon, 20 Jun 2011 09:12:11 GMT
• Content-Type: application/json;
charset=utf-8;
• Content-Length: 138
45. • User apache
• Group apache
• LoadModule php5_module /usr/lib64/
httpd/modules/libphp5.so
46. • DirectoryIndex index.php index.html
• AccessFileName .htaccess
• ErrorLog /opt/logs/error_log
• ErrorDocument 404 /not-found.html
47. <Directory />
Options FollowSymLinks Indexes
AllowOverride None
</Directory>
48. <VirtualHost *:80>
ServerName www.xpmt.com
ServerAlias *.xpmt.com
DocumentRoot /home/panweizeng/mt/webroot
RewriteEngine on
RewriteRule ^/(static/.*)$ /$1 [L]
RewriteRule ^/(.*)$ /index.php [L]
</VirtualHost>
49. <VirtualHost *:80>
ServerName xpmt.com
RewriteEngine On
RewriteRule ^/(.*)$ http://www.xpmt.com/$1 [L,R]
</VirtualHost>
53. ngnix
nginx
apache apache ... apache apache
58. • ControllerFront::importConf
• router config
URL
59. dispatch
• URL
•
• Request
• ControllerAction::runAction
67. • prepend.php(php -i |grep prepend)
/opt/www.config/prepend.php
• prepend.php
~/mt/config/prepend.php
•
config/*
68. prepend.php
• ROOT/TS/DOMAIN_HOST
• include_path
•
• Debug
• autoload
71. • Macbook apache+php
+mysql
• mini web framework php/python/
ruby router
dispatcher orm
•