Advertisement
Guest User

apcheconf

a guest
Sep 16th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.90 KB | None | 0 0
  1. # Autogenerated httpd.conf file for Foswiki.
  2. # Generated at http://foswiki.org/Support/ApacheConfigGenerator?vhost=http://172.30.1.110;port=80;dir=/var/www/foswiki;symlink=;pathurl=/foswiki;shorterurls=enabled;engine=mod_perl;fastcgimodule=fcgid;fcgidreqlen=;apver=2;confighost=;configip=;configuser=;loginmanager=Template;htpath=;errordocument=UserRegistration;errorcustom=;disablephp=on;blockpubhtml=on;blocktrashpub=on;controlattach=;blockspiders=;foswikiversion=2.0;apacheversion=2.4;timeout=;ssl=;sslcert=/etc/ssl/apache2/yourservercert.pem;sslchain=/etc/ssl/apache2/sub.class1.server.ca.pem;sslkey=/etc/ssl/apache2/yourservercertkey.pem
  3.  
  4. # For Foswiki version 2.0, Apache 2.4
  5.  
  6. <VirtualHost *:80>
  7. ServerAdmin webmaster@http://172.30.1.110
  8. DocumentRoot "/var/www/foswiki"
  9. ServerName 172.30.1.110
  10. ErrorLog "/var/www/foswiki/logs/error.log"
  11.  
  12. # The Alias defines a url that points to the root of the Foswiki installation.
  13. # The first parameter will be part of the URL to your installation e.g.
  14. # http://my.co.uk/foswiki/bin/view/...
  15. # The second parameter must point to the physical path on your disc.
  16.  
  17. Alias /foswiki/bin "/var/www/foswiki/bin"
  18.  
  19. # The following Alias is used to access files in the pub directory (attachments etc)
  20. # It must come _after_ the ScriptAlias.
  21. # If short URLs are enabled, and any other local directories or files need to be accessed directly, they
  22. # must also be specified in an Alias statement, and must not conflict with a web name.
  23.  
  24. Alias /foswiki/pub "/var/www/foswiki/pub"
  25. Alias /foswiki/robots.txt "/var/www/foswiki/robots.txt"
  26.  
  27. # Rewriting is required for Short URLs, and Attachment redirecting to viewfile
  28. RewriteEngine on
  29. #RewriteLog "/var/log/apache/rewrite.log"
  30. #RewriteLogLevel 0
  31.  
  32. # short urls
  33. Alias /foswiki "/var/www/foswiki/bin/view"
  34. RewriteRule ^/+foswiki/+bin/+view/+(.*) /foswiki/$1 [L,NE,R]
  35. RewriteRule ^/+foswiki/+bin/+view$ /foswiki/ [L,NE,R]
  36.  
  37. # Block access to typical spam related attachments
  38. # Except the Foswiki directory which is read only and does have attached html files.
  39. SetEnvIf Request_URI "/foswiki/pub/.*\.[hH][tT][mM][lL]?$" blockAccess
  40. SetEnvIf Request_URI "/foswiki/pub/System/.*\.[hH][tT][mM][lL]?$" !blockAccess
  41.  
  42. # This enables access to the documents in the Foswiki root directory
  43.  
  44. <Directory "/var/www/foswiki">
  45. <RequireAll>
  46. Require all granted
  47. Require not env blockAccess
  48. </RequireAll>
  49. </Directory>
  50.  
  51. <IfModule mod_perl.c>
  52. # mod_perl_startup.pl must exist, otherwise Apache will not start.
  53. PerlRequire "/var/www/foswiki/tools/mod_perl_startup.pl"
  54. </IfModule>
  55.  
  56. # This specifies the options on the Foswiki scripts directory. The ExecCGI
  57. # and SetHandler tell apache that it contains scripts. "Allow from all"
  58. # lets any IP address access this URL.
  59. # Note: If you use SELinux, you also have to "Allow httpd cgi support" in your SELinux policies
  60.  
  61. <Directory "/var/www/foswiki/bin">
  62. AllowOverride None
  63.  
  64. <RequireAll>
  65. Require all granted
  66. Require not env blockAccess
  67. </RequireAll>
  68.  
  69. Options +ExecCGI -FollowSymLinks
  70. <IfModule mod_perl.c>
  71. SetHandler perl-script
  72. PerlResponseHandler Foswiki::Engine::Apache
  73. </IfModule>
  74.  
  75. # Password file for Foswiki users
  76. AuthUserFile "/var/www/foswiki/data/.htpasswd"
  77. AuthName 'Enter your WikiName: (First name and last name, no space, no dots, capitalized, e.g. JohnSmith). Cancel to register if you do not have one.'
  78. AuthType Basic
  79.  
  80. # File to return on access control error (e.g. wrong password)
  81. ErrorDocument 401 /foswiki/System/UserRegistration
  82.  
  83. </Directory>
  84.  
  85. # This sets the options on the pub directory, which contains attachments and
  86. # other files like CSS stylesheets and icons. AllowOverride None stops a
  87. # user installing a .htaccess file that overrides these options.
  88. # Note that files in pub are *not* protected by Foswiki Access Controls,
  89. # so if you want to control access to files attached to topics you need to
  90. # block access to the specific directories same way as the ApacheConfigGenerator
  91. # blocks access to the pub directory of the Trash web
  92. <Directory "/var/www/foswiki/pub">
  93. Options None
  94. Options -FollowSymLinks
  95. AllowOverride None
  96.  
  97. <RequireAll>
  98. Require all granted
  99. Require not env blockAccess
  100. </RequireAll>
  101. ErrorDocument 404 /foswiki/bin/viewfile
  102.  
  103. # If you have PHP installed as Apache module, one of the below directives will ensure
  104. # that it is disabled. The "ifmodule" statements should prevent this from causing
  105. # errors if php is not installed.
  106.  
  107. <ifmodule mod_php3.c>
  108. php3_engine off
  109. </ifmodule>
  110. <ifmodule mod_php4.c>
  111. php_admin_flag engine off
  112. </ifmodule>
  113. <ifmodule mod_php5.c>
  114. php_admin_flag engine off
  115. </ifmodule>
  116.  
  117. # This line will redefine the mime type for the most common types of scripts
  118. AddType text/plain .shtml .php .php3 .phtml .phtm .pl .py .cgi
  119. #
  120. # add an Expires header that is sufficiently in the future that the browser does not even ask if its uptodate
  121. # reducing the load on the server significantly
  122. # IF you can, you should enable this - it _will_ improve your Foswiki experience, even if you set it to under one day.
  123. # you may need to enable expires_module in your main apache config
  124. #LoadModule expires_module libexec/httpd/mod_expires.so
  125. #AddModule mod_expires.c
  126. #<ifmodule mod_expires.c>
  127. # <filesmatch "\.(jpe?g|gif|png|css(\.gz)?|js(\.gz)?|ico)$">
  128. # ExpiresActive on
  129. # ExpiresDefault "access plus 11 days"
  130. # </filesmatch>
  131. #</ifmodule>
  132. #
  133. # Serve pre-compressed versions of .js and .css files, if they exist
  134. # Some browsers do not handle this correctly, which is why it is disabled by default
  135. # <FilesMatch "\.(js|css)$">
  136. # RewriteEngine on
  137. # RewriteCond %{HTTP:Accept-encoding} gzip
  138. # RewriteCond %{REQUEST_FILENAME}.gz -f
  139. # RewriteRule ^(.*)$ %{REQUEST_URI}.gz [L,QSA]
  140. # </FilesMatch>
  141. # <FilesMatch "\.(js|css)\?.*$">
  142. # RewriteEngine on
  143. # RewriteCond %{HTTP:Accept-encoding} gzip
  144. # RewriteCond %{REQUEST_FILENAME}.gz -f
  145. # RewriteRule ^([^?]*)\?(.*)$ $1.gz?$2 [L]
  146. # </FilesMatch>
  147. # <FilesMatch "\.js\.gz(\?.*)?$">
  148. # AddEncoding x-gzip .gz
  149. # AddType application/x-javascript .gz
  150. # </FilesMatch>
  151. # <FilesMatch "\.css\.gz(\?.*)?$">
  152. # AddEncoding x-gzip .gz
  153. # AddType text/css .gz
  154. # </FilesMatch>
  155.  
  156. </Directory>
  157.  
  158. # Spammers are known to attach their stuff and then move it to trash where it remains unnoticed.
  159. # We prevent viewing any attachments directly from pub
  160. <Directory "/var/www/foswiki/pub/Trash">
  161. Require all denied
  162. </Directory>
  163.  
  164. # Security note: All other directories should be set so
  165. # that they are *not* visible as URLs, so we set them as =deny from all=.
  166. <Directory "/var/www/foswiki/data">
  167. Require all denied
  168. </Directory>
  169.  
  170. <Directory "/var/www/foswiki/templates">
  171. Require all denied
  172. </Directory>
  173.  
  174. <Directory "/var/www/foswiki/lib">
  175. Require all denied
  176. </Directory>
  177.  
  178. <Directory "/var/www/foswiki/locale">
  179. Require all denied
  180. </Directory>
  181.  
  182. <Directory "/var/www/foswiki/tools">
  183. Require all denied
  184. </Directory>
  185.  
  186. <Directory "/var/www/foswiki/working">
  187. Require all denied
  188. </Directory>
  189.  
  190. # We set an environment variable called blockAccess.
  191. #
  192. # Setting a BrowserMatchNoCase to ^$ is important. It prevents Foswiki from
  193. # including its own topics as URLs and also prevents other Foswikis from
  194. # doing the same. This is important to prevent the most obvious
  195. # Denial of Service attacks.
  196. #
  197. # You can expand this by adding more BrowserMatchNoCase statements to
  198. # block evil browser agents trying to crawl your Foswiki
  199. #
  200. # Example:
  201. # BrowserMatchNoCase ^SiteSucker blockAccess
  202. # BrowserMatchNoCase ^$ blockAccess
  203.  
  204. BrowserMatchNoCase ^$ blockAccess
  205.  
  206. </VirtualHost>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement