Home >Backend Development >PHP Tutorial >nginx source code file structure browsing
The source code version of nginx that I downloaded is not available for testing. According to the date, it is the latest version in 2015year7month. Unzip the package to obtain the source code folder. Enter the root directory and find several subdirectories: auto, conf, contrib, docs, misc, s rc . Literally guessing, it is an automaton or script (auto script), configuration file (configuration), support file (contributions), document (document), miscellaneous ( miscellaneous), source code (source code).
1, browse the root directory of the source code folder
As usual, I chose to look at the documentation first, but there are no detailed offline documents in the doc subdirectory, only the link to the nginx official website and Some small files that are incomprehensible.
MiscellaneousmiscThere is only one GNUmakefile that I can’t quite understand and one README file. There is a
geo2nginx.pl(geo module’s CSVdatabase format conversionperlscript) in the contrib subdirectory, a set of encoding conversion files (including two Encoding map and an encoding conversion perl script), and vim’s nginx dedicated syntax highlighting configuration file.
There are several encoding mapping tables, variable mapping tables and a server configuration file in the conf subdirectory.
There are many scripts in the auto subdirectory, including server installation scripts. It is still difficult to read the scripts now, so I will just browse them briefly. We found that nginx supports many mainstream operating system platforms: Apple’s open source system darwin, important Unix branchesfreebsd, linux, most versions are already open source Another branch of Unixsolaris, with the highest user share win32.
src subdirectories are indeed the source code of nginx that needs to be studied. We will browse in depth below. 2. Browse the src
subdirectoryLet’s take a look at the subdirectories under the src
subdirectory:core, event, http 、 mail, misc, mysql, os, stream. Let’s take a guess based on the literal meaning: core (main function, data structure, main method), event (event processing mechanism), hypertext transfer protocol (http related), email (email related), miscellaneous ( google perftoolsrelated source code), mysqldatabase, operating system (system call program source code of Unix and Win32), stream (unknown meaning). It seems that the ./src/core subdirectory is a good start for studying the source code.
Picture2 nginx
Source file structure diagramCopyright statement: This article is an original article by the blogger and may not be reproduced without the permission of the blogger.