Is there anyone who can put the principle of the website running to say the popular point?

Source: Internet
Author: User
Tags call back website server
In response to the current popular technology;
For example: HTML, CSS, PHP, JavaScript, Database, XML, DOM and so on are exactly what to do, how they work together. How the content of the output Web page is updated.
What is the role of the programming language in the background program, and why it can be used as a server language regardless of programming language, the key is to see which language is most appropriate.

I know that answering this question requires a lot of writing and it will be very hard. My brother thanked the heroes first.

Reply content:

Want to say you visit the essence of the website. You pass the browser (enter the address), the browser first makes a request to the DNS server that you set up, the DNS server returns the actual IP address of the website. Because the IP address of the Internet is unique, according to this IP, your computer can access the public resources provided by this IP, here are some Web site files (js,html,css,img). That is, one IP is a computer, and your request is actually a file that accesses another computer.

Now say the server, commonly used Apache,nginx, the server is the destination IP machine on a daemon, it always monitor the request from the Internet, according to the request to return the corresponding content, as you said before these files are to make a request to the server, and then return to you, return HTML, CSS, JavaScript is given to the browser to parse, rendering the content of the Web page you see.

So what about PHP and the database? The front is just a few static files, if you want to interact with the server dynamically, you have to use the scripting language, the current more popular have php,.net,,jsp, with a lot of CGI. By accessing the server-side script file (for example: / http t.cn/login.php ), then the script has access to the server local resources, databases and other permissions, according to the content of your request, the script is parsed back to the server, the server returned to you.

Database is mainly used to dynamically store data, easy to find, insert, query, delete and other operations. Mysql,oracle,sql server, as well as some NoSQL products, are databases.

XML is mainly used for data exchange, storage configuration information, data. Also general documents, but have their own writing specifications, all have a set of parsing engine for content parsing. The scripting language, or just C++,,java, can manipulate XML files.

Dom is called a node, this is the concept of XML, because XML is not labeled, HTML is a branch of it, for more specific areas, open a Web page, right-click, choose to view the source code, you can see the closed-tagged XML file, in order to index each content point, The concept of the Node (DOM) is introduced, and the XML element can be quickly located by the aspect of the DOM through the hierarchical lookup. Back to Landlord:
A little popular? : Take Win\iis\php\mysql\ie as an example
1\ Xiao Ming turn on the computer
2\ running the browser
3\ Open a URL / http zhihu.com/
4\ Xiao Ming's computer through DNS to find the IP address that this URL points to
5\ Browser makes access to this IP address / http zhihu.com The request
6\ / http zhihu.com Web server software receives a request to query whether a site is bound to this domain name
7\ If an unbound return error code or default site (set allow) if there is a binding execution no.8
8\ / http zhihu.com This URL is a default file that follows the directory not a file Web server software query settings such as index.php
9.web server to determine the file type and the corresponding interpreter if it is PHP notify Php.exe (Php-cgi.exe): "Brother has a foreigner letter to you to translate" PHP after receiving the notification PHP file PHP French interpretation (if you have database connection information and database query information And then through the corresponding link driver to inform him other database brothers execute the query results and return to PHP) PHP after the PHP syntax to explain the results to IIS IIS and so on after PHP, and then left in the hands of html\js\css these three kinds of client browser directly executed files Complete the fragment with PHP translation and return it to the client
10.no.6-9, Xiaoming's browser has been waiting for the browser state: "Looking for a site", "linking the site," "found the site is waiting for response", "Download Data", "parsing, rendering, execution, printout" ...
11. So far, xiaoming can see / http zhihu.com The homepage ...

Back to Sinming:
More advanced technology can become pro-people
Can change is one thing (change!) )
There is no need to change is another matter (meaningless!) )
This problem is like eating meat needs to understand this animal's life law, thought sentiment ... Are you going to do it? What if you're only interested in a computer that's not interested in animals? What about people who are interested in animals? Can they go and talk to the people?

Technical aspects of the problem no one can do everything except their own career direction for a lifetime of a century just who can really do know astronomy, the next know geography, in Xiao people and, Ming Yin and Yang, understand gossip, know strange door, Xiao Dun armour, in the winning thousands, beyond ... China 5,000 years also out of the various Zhuge Ming a person

And it's not that he's not pro-people, it's the same thing. You didn't find out if you were really interested in this world there are too many resources available for you to learn and not to blame the technology not the people just you did not learn.
At the same time, the technical (scientific) knowledge and the humanities knowledge, the folk custom is different he certainly will have certain seriousness, the strict sex

Finally: Europe and the United States have a better understanding of technology than our country you can go to the European and American universities on the website public Information and public courses to find something you are interested in the server and client: This is the first concept you have to understand, and now you see that the web is to put the code and data on the server, Then the client you are using a kind of thing called browser (browser), you may be using IE, perhaps with Firefox, perhaps with Chome, in short, they are browser, Browser's role is to send requests (request) and receive request results (response) to the server, for example, you click a link to a website button, send a request to the server, and some of the request with data, such as you send a Weibo, You just want to request the server: Give me a microblogging database to add a micro-blog data, the increase is the content of the request to the server.
PHP: After the server receives the request, he will know to parse the request and then start the action, instruct him how to do things is some code, such as PHP Code, ASP code, these are the server programming language, in 23 languages can be, these languages will be their corresponding application Server software knowledge, Your one request, the server will resolve to run your request, and then return to some pictures, some HTML files, CSS files, javasript script, in short can be said to be a Web page need to file it, back to the client. such as the previous request; Add a micro-blog data to my Weibo database, this time the server to operate the database, add a record database, if successful, return the results said the operation was successful.
HTML,CSS: After the request results returned to the client, these files only the browser can understand the resolution, the browser to assemble them well, the HTML is mainly the content of the Web page, CSS is to decorate these content, such as text pictures how to layout, text how big, background color, Some of the dynamic effects of web pages are controlled by the returned JS. At this point, people are able to read the results returned by the server intuitively.
javascript: Sometimes you can not always look for the server, the server also feel trouble, this time, Javasript came into being, it is a client script code, is a browser to execute, that is, there are small things he gave you immediately do, do not need to go all the way to find the server. For example, you have a time to fill in the password, the format of the password is not correct, complete the submission, JS script stopped first check not qualified, pass to find the server, unqualified directly to call back to remind you unqualified. JS can do a lot of things, it will make your Web page move up.
Database: The database can think of him as an archive, all the data in the data server hard disk organized neatly organized, database software also some busy file managers, some responsible for the deletion of data, some responsible for backup or data security and so on. Outside of the software, such as the server through the "interface" channel to the database is mainly some data manipulation, such as adding or removing changes to read.
XML: Data is a physical format, that is, the data is organized in a certain structure, such as your World document, Doc can be regarded as a physical format of data, the computer world is essentially data, a variety of structures and formats of data. The advantage of XML data format is that a lot of software know him, is a public format, is a common format of data, XML can do all kinds of software communication, the second is good reading, in line with people's reading habits. Relatively good operation, programming language directly can operate, generally as a software configuration file to use.
DOM node: It is the organization of XML data, and the XML data is a node-node node formed by nodes. And why nodes are so important, because the web's underlying HTML is also a disguised form of XML data.
Almost so, a lot of it is not rigorous, laughed at. This is how the site works:

The user's browser (client) sends a request through the Network (protocol) to the website server, the server generates the Web content based on the user's request (and the server's own data, the current user's status), sends it back to the browser via the Network (protocol), and the browser interprets the Web page (HTML format) sent by the server The end user sees what the page looks like.

Network protocol: HTTP

Client: HTML (DOM), CSS, JavaScript, XML

Server-side: Database, Http-server Longchengliang has well explained the fundamentals of website programs

I would add here, as I understand it, to make it simpler, a website = server + domain + website programs and resources.
To build a website, you need to prepare the three parts that I mentioned above
    1. Server, used to store the website program and let the website program normal operation, can be understood as a connection on the Internet on a 24-hour computer, the computer's IP is generally fixed (of course, there are software to achieve with dynamic IP server, here for the moment, regardless of), So that other users on the Internet can find the resources on the server exactly.
    2. Domain name, because the IP is difficult to remember, so use the domain name to resolve to the server IP, the server is bound to the domain name, so that can be easily remembered by the domain name to access the resources on the server. The domain name can be registered with the Domain name Registrar website. If http://zhihu.com is registered with the Domain name Registrar/ httpgodaddy.com .
    3. A website program is a collection of programs and resources needed to implement a site's functionality. Website programs and resources are stored on the server's hard disk.

Examples: For example, to build / http zhihu.com This site, then the following steps are required:
    1. Purchase a server (small site can also use virtual host or VPS), configure the server information;
    2. Develop good website program, upload website program to server, configure database connection and other information;
    3. To the Domain Name Registrar website Registration http/zhihu.com This domain name (if the domain name has already been registered by others and you want that can be paid to contact the domain name holder to buy), the domain name to the server Ip,ok, Such an HTTP://zhihu.com site is set up, the next step is to publicize the Operation Bar.


To add, if you use a domestic server, then the domain name must first record before you can access OH. Another line: Now the website filing system very frustrating very sick oh indeed, I have a lot of questions. The internet looked up a lot of information. But a lot of questions are still half-understood.
such as the principle of computer operation. Someone said it would make people understand.
I think technology, no matter how advanced, should be a "pro-people" side, rather than high. Chinese version address:
> http://www. Html5rocks.com/zh/tutor ials/internals/howbrowserswork/#Resources

English version address:
> / http Taligarsiel.com/project s/howbrowserswork1.htm In fact, this should not be a problem, it is not clear that you have been learning now do not know how to classify? Or are you going to start learning?
HTML CSS JS These in the client run, PHP in the server interpretation run ~ equivalent every time you use a browser to send a request, the specified server will respond, to PHP processing to get html,css and other files (including the picture JS file ah and so on), Then the client downloads these binaries!
In this process, it should be a watershed when PHP finishes processing the returned data! Front and back end of each camp ~

Not necessarily right, almost like that. hehe ~ you are asking how the website works, here to explain the most popular dynamic website working principle, take PHP as an example. Take a closer look at the picture.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.