frontend-apache.conf 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. ServerRoot "/usr/local/apache2"
  2. Listen 80
  3. LoadModule mpm_event_module modules/mod_mpm_event.so
  4. LoadModule authn_core_module modules/mod_authn_core.so
  5. LoadModule authz_core_module modules/mod_authz_core.so
  6. LoadModule access_compat_module modules/mod_access_compat.so
  7. LoadModule mime_module modules/mod_mime.so
  8. LoadModule log_config_module modules/mod_log_config.so
  9. LoadModule env_module modules/mod_env.so
  10. #LoadModule expires_module modules/mod_expires.so
  11. LoadModule headers_module modules/mod_headers.so
  12. #LoadModule setenvif_module modules/mod_setenvif.so
  13. #LoadModule remoteip_module modules/mod_remoteip.so
  14. LoadModule proxy_module modules/mod_proxy.so
  15. LoadModule proxy_http_module modules/mod_proxy_http.so
  16. LoadModule unixd_module modules/mod_unixd.so
  17. #LoadModule status_module modules/mod_status.so
  18. #LoadModule autoindex_module modules/mod_autoindex.so
  19. LoadModule dir_module modules/mod_dir.so
  20. LoadModule alias_module modules/mod_alias.so
  21. LoadModule session_module modules/mod_session.so
  22. LoadModule session_crypto_module modules/mod_session_crypto.so
  23. LoadModule session_cookie_module modules/mod_session_cookie.so
  24. LoadModule request_module modules/mod_request.so
  25. LoadModule authz_user_module modules/mod_authz_user.so
  26. LoadModule auth_form_module modules/mod_auth_form.so
  27. LoadModule authn_dbd_module modules/mod_authn_dbd.so
  28. LoadModule dbd_module modules/mod_dbd.so
  29. LoadModule macro_module modules/mod_macro.so
  30. LoadModule rewrite_module modules/mod_rewrite.so
  31. <IfModule unixd_module>
  32. #
  33. # If you wish httpd to run as a different user or group, you must run
  34. # httpd as root initially and it will switch.
  35. #
  36. # User/Group: The name (or #number) of the user/group to run httpd as.
  37. # It is usually good practice to create a dedicated user and group for
  38. # running httpd, as with most system services.
  39. #
  40. User daemon
  41. Group daemon
  42. </IfModule>
  43. ServerAdmin you@example.com
  44. ServerName feedati-fe:80
  45. DBDriver pgsql
  46. DBDParams "host=db dbname=feeds user=apache password=apachepass"
  47. <Macro Auth>
  48. AuthFormLoginRequiredLocation "/login/"
  49. # authn
  50. AuthFormProvider dbd
  51. AuthDBDUserPWQuery "SELECT password FROM users.users WHERE username = %s"
  52. # form
  53. AuthType form
  54. AuthName "authenticationform"
  55. # mod_session
  56. Session On
  57. SessionCookieName session path=/;httponly
  58. SessionCryptoPassphrase changeme!really!
  59. </Macro>
  60. <Location "/login/do">
  61. SetHandler form-login-handler
  62. Use Auth
  63. AuthFormLoginSuccessLocation "/panel/"
  64. </Location>
  65. <Location "/logout">
  66. SetHandler form-logout-handler
  67. AuthFormLogoutLocation "/login/logout.html"
  68. Session on
  69. </Location>
  70. <Directory />
  71. AllowOverride none
  72. Require all denied
  73. </Directory>
  74. DocumentRoot "/var/www"
  75. <Directory "/var/www">
  76. Options None
  77. AllowOverride None
  78. Use Auth
  79. Require all granted
  80. </Directory>
  81. <Files ".ht*">
  82. Require all denied
  83. </Files>
  84. # ErrorLog: The location of the error log file.
  85. # If you do not specify an ErrorLog directive within a <VirtualHost>
  86. # container, error messages relating to that virtual host will be
  87. # logged here. If you *do* define an error logfile for a <VirtualHost>
  88. # container, that host's errors will be logged there and not here.
  89. #
  90. ErrorLog /proc/self/fd/2
  91. # LogLevel: Control the number of messages logged to the error_log.
  92. # Possible values include: debug, info, notice, warn, error, crit,
  93. # alert, emerg.
  94. LogLevel warn
  95. <IfModule log_config_module>
  96. #
  97. # The following directives define some format nicknames for use with
  98. # a CustomLog directive (see below).
  99. #
  100. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
  101. LogFormat "%h %l %u %t \"%r\" %>s %b" common
  102. <IfModule logio_module>
  103. # You need to enable mod_logio.c to use %I and %O
  104. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
  105. </IfModule>
  106. #
  107. # The location and format of the access logfile (Common Logfile Format).
  108. # If you do not define any access logfiles within a <VirtualHost>
  109. # container, they will be logged here. Contrariwise, if you *do*
  110. # define per-<VirtualHost> access logfiles, transactions will be
  111. # logged therein and *not* in this file.
  112. #
  113. CustomLog /proc/self/fd/1 common
  114. #
  115. # If you prefer a logfile with access, agent, and referer information
  116. # (Combined Logfile Format) you can use the following directive.
  117. #
  118. #CustomLog "logs/access_log" combined
  119. </IfModule>
  120. <IfModule headers_module>
  121. #
  122. # Avoid passing HTTP_PROXY environment to CGI's on this or any proxied
  123. # backend servers which have lingering "httpoxy" defects.
  124. # 'Proxy' request header is undefined by the IETF, not listed by IANA
  125. #
  126. RequestHeader unset Proxy early
  127. </IfModule>
  128. <IfModule mime_module>
  129. #
  130. # TypesConfig points to the file containing the list of mappings from
  131. # filename extension to MIME-type.
  132. #
  133. TypesConfig conf/mime.types
  134. #
  135. # AddType allows you to add to or override the MIME configuration
  136. # file specified in TypesConfig for specific file types.
  137. #
  138. #AddType application/x-gzip .tgz
  139. #
  140. # AddEncoding allows you to have certain browsers uncompress
  141. # information on the fly. Note: Not all browsers support this.
  142. #
  143. #AddEncoding x-compress .Z
  144. #AddEncoding x-gzip .gz .tgz
  145. #
  146. # If the AddEncoding directives above are commented-out, then you
  147. # probably should define those extensions to indicate media types:
  148. #
  149. AddType application/x-compress .Z
  150. AddType application/x-gzip .gz .tgz
  151. #
  152. # AddHandler allows you to map certain file extensions to "handlers":
  153. # actions unrelated to filetype. These can be either built into the server
  154. # or added with the Action directive (see below)
  155. #
  156. # To use CGI scripts outside of ScriptAliased directories:
  157. # (You will also need to add "ExecCGI" to the "Options" directive.)
  158. #
  159. #AddHandler cgi-script .cgi
  160. # For type maps (negotiated resources):
  161. #AddHandler type-map var
  162. #
  163. # Filters allow you to process content before it is sent to the client.
  164. #
  165. # To parse .shtml files for server-side includesC (SSI):
  166. # (You will also need to add "Includes" to the "Options" directive.)
  167. #
  168. #AddType text/html .shtml
  169. #AddOutputFilter INCLUDES .shtml
  170. </IfModule>
  171. Redirect permanent "/tt-rss" "/tt-rss/"
  172. Header always set Referrer-Policy "same-origin"
  173. Header always setifempty Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'"
  174. Header always setifempty X-XSS-Protection "1; mode=block"
  175. Header always setifempty X-Frame-Options "deny"
  176. ProxyPreserveHost On
  177. <Location /tt-rss/>
  178. ProxyPass http://tt-rss/tt-rss/
  179. ProxyPassReverse http://tt-rss/tt-rss/
  180. Use Auth
  181. Require valid-user
  182. RewriteEngine on
  183. RewriteRule .* - [E=RU:%{LA-U:REMOTE_USER},NS]
  184. RequestHeader set X-Forwarded-User %{RU}e
  185. </Location>
  186. Redirect permanent "/rss-bridge" "/rss-bridge/"
  187. <Location /rss-bridge/>
  188. ProxyPass http://rss-bridge/
  189. ProxyPassReverse http://rss-bridge/
  190. Require all granted
  191. </Location>
  192. <Location /panel/>
  193. ProxyPass http://panel:8000/
  194. ProxyPassReverse http://panel:8000/
  195. Use Auth
  196. Require valid-user
  197. RewriteEngine on
  198. RewriteRule .* - [E=RU:%{LA-U:REMOTE_USER},NS]
  199. RequestHeader set X-Forwarded-User %{RU}e
  200. </Location>
  201. # vim: set ft=apache bkc=yes: