Advertisement
kabads

apache config

May 15th, 2018
616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.18 KB | None | 0 0
  1. #
  2. # This is the main Apache HTTP server configuration file. It contains the
  3. # configuration directives that give the server its instructions.
  4. # See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
  5. # In particular, see
  6. # <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
  7. # for a discussion of each configuration directive.
  8. #
  9. # Do NOT simply read the instructions in here without understanding
  10. # what they do. They're here only as hints or reminders. If you are unsure
  11. # consult the online docs. You have been warned.
  12. #
  13. # Configuration and logfile names: If the filenames you specify for many
  14. # of the server's control files begin with "/" (or "drive:/" for Win32), the
  15. # server will use that explicit path. If the filenames do *not* begin
  16. # with "/", the value of ServerRoot is prepended -- so 'log/access_log'
  17. # with ServerRoot set to '/www' will be interpreted by the
  18. # server as '/www/log/access_log', where as '/log/access_log' will be
  19. # interpreted as '/log/access_log'.
  20.  
  21. #
  22. # ServerRoot: The top of the directory tree under which the server's
  23. # configuration, error, and log files are kept.
  24. #
  25. # Do not add a slash at the end of the directory path. If you point
  26. # ServerRoot at a non-local disk, be sure to specify a local disk on the
  27. # Mutex directive, if file-based mutexes are used. If you wish to share the
  28. # same ServerRoot for multiple httpd daemons, you will need to change at
  29. # least PidFile.
  30. #
  31. ServerRoot "/etc/httpd"
  32.  
  33. #
  34. # Listen: Allows you to bind Apache to specific IP addresses and/or
  35. # ports, instead of the default. See also the <VirtualHost>
  36. # directive.
  37. #
  38. # Change this to Listen on specific IP addresses as shown below to
  39. # prevent Apache from glomming onto all bound IP addresses.
  40. #
  41. #Listen 12.34.56.78:80
  42. Listen 80
  43.  
  44. #
  45. # Dynamic Shared Object (DSO) Support
  46. #
  47. # To be able to use the functionality of a module which was built as a DSO you
  48. # have to place corresponding `LoadModule' lines at this location so the
  49. # directives contained in it are actually available _before_ they are used.
  50. # Statically compiled modules (those listed by `httpd -l') do not need
  51. # to be loaded here.
  52. #
  53. # Example:
  54. # LoadModule foo_module modules/mod_foo.so
  55. #
  56. Include conf.modules.d/*.conf
  57.  
  58.  
  59.  
  60.  
  61. #
  62. # If you wish httpd to run as a different user or group, you must run
  63. # httpd as root initially and it will switch.
  64. #
  65. # User/Group: The name (or #number) of the user/group to run httpd as.
  66. # It is usually good practice to create a dedicated user and group for
  67. # running httpd, as with most system services.
  68. #
  69. User apache
  70. Group apache
  71.  
  72. # 'Main' server configuration
  73. #
  74. # The directives in this section set up the values used by the 'main'
  75. # server, which responds to any requests that aren't handled by a
  76. # <VirtualHost> definition. These values also provide defaults for
  77. # any <VirtualHost> containers you may define later in the file.
  78. #
  79. # All of these directives may appear inside <VirtualHost> containers,
  80. # in which case these default settings will be overridden for the
  81. # virtual host being defined.
  82. #
  83.  
  84. #
  85. # ServerAdmin: Your address, where problems with the server should be
  86. # e-mailed. This address appears on some server-generated pages, such
  87. # as error documents. e.g. admin@your-domain.com
  88. #
  89. ServerAdmin root@localhost
  90.  
  91. #
  92. # ServerName gives the name and port that the server uses to identify itself.
  93. # This can often be determined automatically, but we recommend you specify
  94. # it explicitly to prevent problems during startup.
  95. #
  96. # If your host doesn't have a registered DNS name, enter its IP address here.
  97. #
  98. #ServerName www.example.com:80
  99.  
  100. #
  101. # Deny access to the entirety of your server's filesystem. You must
  102. # explicitly permit access to web content directories in other
  103. # <Directory> blocks below.
  104. #
  105. <Directory />
  106. AllowOverride all
  107. Require all denied
  108. Options FollowSymLink
  109.  
  110. </Directory>
  111.  
  112. #
  113. # Note that from this point forward you must specifically allow
  114. # particular features to be enabled - so if something's not working as
  115. # you might expect, make sure that you have specifically enabled it
  116. # below.
  117. #
  118.  
  119. #
  120. # DocumentRoot: The directory out of which you will serve your
  121. # documents. By default, all requests are taken from this directory, but
  122. # symbolic links and aliases may be used to point to other locations.
  123. #
  124. DocumentRoot "/var/www/html"
  125. #
  126. # Relax access to content within /var/www.
  127. #
  128. <Directory "/var/www">
  129. AllowOverride None
  130. # Allow open access:
  131. Require all granted
  132. </Directory>
  133.  
  134. # Further relax access to the default document root:
  135. <Directory "/var/www/html">
  136. #
  137. # Possible values for the Options directive are "None", "All",
  138. # or any combination of:
  139. # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
  140. #
  141. # Note that "MultiViews" must be named *explicitly* --- "Options All"
  142. # doesn't give it to you.
  143. #
  144. # The Options directive is both complicated and important. Please see
  145. # http://httpd.apache.org/docs/2.4/mod/core.html#options
  146. # for more information.
  147. #
  148. Options Indexes FollowSymLinks
  149.  
  150. #
  151. # AllowOverride controls what directives may be placed in .htaccess files.
  152. # It can be "All", "None", or any combination of the keywords:
  153. # Options FileInfo AuthConfig Limit
  154. #
  155. AllowOverride None
  156.  
  157. #
  158. # Controls who can get stuff from this server.
  159. #
  160. Require all granted
  161. </Directory>
  162.  
  163. #
  164. # DirectoryIndex: sets the file that Apache will serve if a directory
  165. # is requested.
  166. #
  167. <IfModule dir_module>
  168. DirectoryIndex index.html
  169. </IfModule>
  170.  
  171. #
  172. # The following lines prevent .htaccess and .htpasswd files from being
  173. # viewed by Web clients.
  174. #
  175. <Files ".ht*">
  176. Require all denied
  177. </Files>
  178.  
  179. #
  180. # ErrorLog: The location of the error log file.
  181. # If you do not specify an ErrorLog directive within a <VirtualHost>
  182. # container, error messages relating to that virtual host will be
  183. # logged here. If you *do* define an error logfile for a <VirtualHost>
  184. # container, that host's errors will be logged there and not here.
  185. #
  186. ErrorLog "logs/error_log"
  187.  
  188. #
  189. # LogLevel: Control the number of messages logged to the error_log.
  190. # Possible values include: debug, info, notice, warn, error, crit,
  191. # alert, emerg.
  192. #
  193. LogLevel warn
  194.  
  195. <IfModule log_config_module>
  196. #
  197. # The following directives define some format nicknames for use with
  198. # a CustomLog directive (see below).
  199. #
  200. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
  201. LogFormat "%h %l %u %t \"%r\" %>s %b" common
  202.  
  203. <IfModule logio_module>
  204. # You need to enable mod_logio.c to use %I and %O
  205. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
  206. </IfModule>
  207.  
  208. #
  209. # The location and format of the access logfile (Common Logfile Format).
  210. # If you do not define any access logfiles within a <VirtualHost>
  211. # container, they will be logged here. Contrariwise, if you *do*
  212. # define per-<VirtualHost> access logfiles, transactions will be
  213. # logged therein and *not* in this file.
  214. #
  215. #CustomLog "logs/access_log" common
  216.  
  217. #
  218. # If you prefer a logfile with access, agent, and referer information
  219. # (Combined Logfile Format) you can use the following directive.
  220. #
  221. CustomLog "logs/access_log" combined
  222. </IfModule>
  223.  
  224. <IfModule alias_module>
  225. #
  226. # Redirect: Allows you to tell clients about documents that used to
  227. # exist in your server's namespace, but do not anymore. The client
  228. # will make a new request for the document at its new location.
  229. # Example:
  230. # Redirect permanent /foo http://www.example.com/bar
  231.  
  232. #
  233. # Alias: Maps web paths into filesystem paths and is used to
  234. # access content that does not live under the DocumentRoot.
  235. # Example:
  236. # Alias /webpath /full/filesystem/path
  237. #
  238. # If you include a trailing / on /webpath then the server will
  239. # require it to be present in the URL. You will also likely
  240. # need to provide a <Directory> section to allow access to
  241. # the filesystem path.
  242.  
  243. #
  244. # ScriptAlias: This controls which directories contain server scripts.
  245. # ScriptAliases are essentially the same as Aliases, except that
  246. # documents in the target directory are treated as applications and
  247. # run by the server when requested rather than as documents sent to the
  248. # client. The same rules about trailing "/" apply to ScriptAlias
  249. # directives as to Alias.
  250. #
  251. ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
  252.  
  253. </IfModule>
  254.  
  255. #
  256. # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
  257. # CGI directory exists, if you have that configured.
  258. #
  259. <Directory "/var/www/cgi-bin">
  260. AllowOverride None
  261. Options None
  262. Require all granted
  263. </Directory>
  264.  
  265. <IfModule mime_module>
  266. #
  267. # TypesConfig points to the file containing the list of mappings from
  268. # filename extension to MIME-type.
  269. #
  270. TypesConfig /etc/mime.types
  271.  
  272. #
  273. # AddType allows you to add to or override the MIME configuration
  274. # file specified in TypesConfig for specific file types.
  275. #
  276. #AddType application/x-gzip .tgz
  277. #
  278. # AddEncoding allows you to have certain browsers uncompress
  279. # information on the fly. Note: Not all browsers support this.
  280. #
  281. #AddEncoding x-compress .Z
  282. #AddEncoding x-gzip .gz .tgz
  283. #
  284. # If the AddEncoding directives above are commented-out, then you
  285. # probably should define those extensions to indicate media types:
  286. #
  287. AddType application/x-compress .Z
  288. AddType application/x-gzip .gz .tgz
  289.  
  290. #
  291. # AddHandler allows you to map certain file extensions to "handlers":
  292. # actions unrelated to filetype. These can be either built into the server
  293. # or added with the Action directive (see below)
  294. #
  295. # To use CGI scripts outside of ScriptAliased directories:
  296. # (You will also need to add "ExecCGI" to the "Options" directive.)
  297. #
  298. #AddHandler cgi-script .cgi
  299.  
  300. # For type maps (negotiated resources):
  301. #AddHandler type-map var
  302.  
  303. #
  304. # Filters allow you to process content before it is sent to the client.
  305. #
  306. # To parse .shtml files for server-side includes (SSI):
  307. # (You will also need to add "Includes" to the "Options" directive.)
  308. #
  309. AddType text/html .shtml
  310. AddOutputFilter INCLUDES .shtml
  311. </IfModule>
  312.  
  313. #
  314. # Specify a default charset for all content served; this enables
  315. # interpretation of all content as UTF-8 by default. To use the
  316. # default browser choice (ISO-8859-1), or to allow the META tags
  317. # in HTML content to override this choice, comment out this
  318. # directive:
  319. #
  320. AddDefaultCharset UTF-8
  321.  
  322. <IfModule mime_magic_module>
  323. #
  324. # The mod_mime_magic module allows the server to use various hints from the
  325. # contents of the file itself to determine its type. The MIMEMagicFile
  326. # directive tells the module where the hint definitions are located.
  327. #
  328. MIMEMagicFile conf/magic
  329. </IfModule>
  330.  
  331. #
  332. # Customizable error responses come in three flavors:
  333. # 1) plain text 2) local redirects 3) external redirects
  334. #
  335. # Some examples:
  336. #ErrorDocument 500 "The server made a boo boo."
  337. #ErrorDocument 404 /missing.html
  338. #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
  339. #ErrorDocument 402 http://www.example.com/subscription_info.html
  340. #
  341.  
  342. #
  343. # EnableMMAP and EnableSendfile: On systems that support it,
  344. # memory-mapping or the sendfile syscall may be used to deliver
  345. # files. This usually improves server performance, but must
  346. # be turned off when serving from networked-mounted
  347. # filesystems or if support for these functions is otherwise
  348. # broken on your system.
  349. # Defaults if commented: EnableMMAP On, EnableSendfile Off
  350. #
  351. #EnableMMAP off
  352. EnableSendfile on
  353.  
  354. # Supplemental configuration
  355. #
  356. # Load config files in the "/etc/httpd/conf.d" directory, if any.
  357. IncludeOptional conf.d/*.conf
  358.  
  359. NameVirtualHost *:80
  360.  
  361. <VirtualHost *:80>
  362. ServerAdmin me@domain.com
  363. ServerName www.domain.com
  364. DocumentRoot /var/www/html/
  365. CustomLog /var/log/apache/access.log combined
  366.  
  367. #RewriteEngine On
  368. #RewriteCond %{HTTP:X-Forwarded-Proto} =http
  369. #RewriteRule .* https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent]
  370.  
  371. </VirtualHost>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement