Title: Theory / Unimportant / CS / Softw / Server / Apache / Configuration
Tags: FromInstruction computer_to_instruction hasNotNewEffectReturnsMeaning some_instruction

Question: By default, apache listen to
Answer: every port and interfaces.
Page: http://httpd.apache.org/docs/2.4/en/bind.html

Question: What happens if two directive ask to listen for overlaping port (and ip) ?
Answer: An error forbidding starting up
Page: http://httpd.apache.org/docs/2.4/en/bind.html

Question: Which is the default protocol ?
Answer: https for port 443, http otherwise
Page: http://httpd.apache.org/docs/2.4/en/bind.html

Instruction: <IfModule !bar>foo</IfModule>
Page: http://httpd.apache.org/docs/2.4/en/bind.html
Effect: foo if the module bar is not loaded, else nothing
Where to use it: Configuration file

Instruction: <Directory bar_1 bar_n>foo</Directory>
Page: http://httpd.apache.org/docs/2.4/en/mod/core.html#directory
Effect: Applies directives foo to elements of some of the bar_n
Where to use it: Configuration file
Assuming: bar_i must be the exact way by which apache access the files

Question: In which order rules are applied
Answer: Rules of those directory commands/.htaccess are applied, using first the rules related to the least prefix of the path.
Then the rules for regexps are applied in the order in which those regexps are defined
Then rules from Files in the order in which they are defined
Then rules from Location
Page: http://httpd.apache.org/docs/2.4/en/mod/core.html#directory
http://httpd.apache.org/docs/2.4/en/mod/core.html#files

Instruction: <TypeMatch bar>foo</TypeMatch> (or <Type ~ bar>foo</Type> but not advised)
Page: http://httpd.apache.org/docs/2.4/en/mod/core.html#directorymatch
Effect: Similar to <Type bar>foo</Type>
Applies directives foo to elements which match the regexp bar.
In foo, each captured group g of bar set the variable MATCH_g to its value
Variables: Type being location, files or directory

Instruction: <Files bar_1 bar_n>foo</Files>
Page: http://httpd.apache.org/docs/2.4/en/mod/core.html#files
Effect: Applies directives foo whose file name is some of the bar_n
Where to use it: Configuration file
Assuming: bar_i must be the exact way by which apache access the files

Instruction: <Location bar_1 bar_n>foo</Location>
Page: http://httpd.apache.org/docs/2.4/en/mod/core.html#location
Effect: Applies directives foo to URL such that some bar_i is a path prefix (i.e. the URL is of the form bar_i or bar_i/buz)
Where to use it: Configuration file
Assuming: Protocol should be stated iff it is in proxy (TODO)

Instruction: <VirtualHost bar_1 bar_n>foo</VirtualHost>
Page: http://httpd.apache.org/docs/2.4/en/mod/core.html#virtualhost
Effect: Applies directives foo to requests whose URL corresponds to a VirtualHost bar_i configuration.
Where to use it: Configuration file

Question: Which virtual host is choosen
Answer: The one corresponding the most to IP:port.
In case of equality, the one without wildcard is preferred.
In case of equality, the one whose hostname match best.
In case of equality, the first one is selected.
Page: http://httpd.apache.org/docs/2.4/en/mod/core.html#virtualhost

Instruction: AccessFileName foo
Page: http://httpd.apache.org/docs/2.4/en/mod/core.html#accessfilename
Effect: When accessing a path /dir_1/.../dir_n reads /dir_1/.../dir_i/foo , for 0<i<n+1, to search for directives.

Instruction: AllowOverride foo
Page: http://httpd.apache.org/docs/2.4/en/mod/core.html#allowoverride
Effect: State that directives can or cannot be overrided in local configuration files, according to foo
Extra: values for foo are not given

Question: How to specify IPv6 address
Answer: Inside of brackets
Page: http://httpd.apache.org/docs/2.4/en/mod/core.html#virtualhost
Context: Apache config file

Instruction: Listen p
Page: http://httpd.apache.org/docs/2.4/en/bind.html
Effect: Listen to port p

Instruction: Listen ip:p
Page: http://httpd.apache.org/docs/2.4/en/bind.html
Effect: Listen to port p on the interface whose IP is ip

Instruction: Listen ip:port pr
Page: http://httpd.apache.org/docs/2.4/en/bind.html
Effect: State to listen to port port on interface whose IP is ip, its input are treated as coming with protocol pr

Instruction: \ followed by a newline
Page: http://httpd.apache.org/docs/2.4/en/bind.html
Effect: The next line resume the following line of the config file
Where to use it: Configuration file

Instruction: #
Page: http://httpd.apache.org/docs/2.4/en/bind.html
Effect: Starts a comment until end of line
Context: Configuration file

Instruction: ${V}
Page: http://httpd.apache.org/docs/2.4/en/bind.html
Effect: The value of V as in Define.
If it does not exists, as the environment variable.
If it does not exists, is not replaced and a warning is emitted
Where to use it: Configuration file
Assuming: V should not contain ":"

Instruction: <IfModule bar>foo</IfModule>
Page: http://httpd.apache.org/docs/2.4/en/bind.html
Effect: foo if the module bar is loaded, else nothing
Context: Apaches's Configuration file