简体   繁体   中英

Proper use of Header set Connection Keep-Alive (Apache)

<ifModule mod_headers.c>
   Header set Connection keep-alive
</ifModule>

In order to make files reloading bit faster, a server needs the Keep Alive enabled in Apache. Some questions though:

Q1) does it matter where (top or bottom of htacces) these three lines go?

Q2) if I omit the ifModule above and below the Header set Connection keep-alive then it seems still to work so is it necessary / what does the ifModule do?

Q3) on the bottom of my htacces there is already a section with ifModule mod_headers.c and all sorts of FilesMatch in there (static caching of files per filetype like css js html etc. can the Header set Connection keep-alive go in there?

Q1) It only matters if there are other lines in the file that may override it. In general, whatever comes last wins.

Q2) ifModule is a basic conditional that allows you to specify configuration if the indicated module is loaded or not

Q3) Yes, it can go in there. A conditional is a conditional, so unless you have a rather complex module-dependent configuration, you will only really need one ifModule block for any given module in a particular file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM