1 # Autogenerated httpd.conf file for Foswiki.
2 # Generated at http://foswiki.org/Support/ApacheConfigGenerator?vhost=localhost;port=;dir=/srv/http/htdocs/foswiki;symlink=on;pathurl=/foswiki;shorterurls=enabled;engine=CGI;fastcgimodule=fastcgi;apver=2;allowconf=;requireconf=foswiki;loginmanager=Template;htpath=;errordocument=UserRegistration;errorcustom=;phpinstalled=None;blockpubhtml=;blocktrashpub=;controlattach=;blockspiders=;foswikiversion=1.1
4 # For Foswiki version 1.1
12 ServerAdmin webmaster@localhost
13 DocumentRoot /srv/http/htdocs/foswiki
16 # ServerAlias www.localhost # Optional. Add to list of redirect hosts in bin/configure
19 # The Alias defines a url that points to the root of the Foswiki installation.
20 # The first parameter will be part of the URL to your installation e.g.
21 # http://my.co.uk/foswiki/bin/view/...
22 # The second parameter must point to the physical path on your disc.
24 ScriptAlias /foswiki/bin "/srv/http/htdocs/foswiki/bin"
26 # The following Alias is used to access files in the pub directory (attachments etc)
27 # It must come _after_ the ScriptAlias.
28 # If short URLs are enabled, and any other local directories or files need to be accessed directly, they
29 # must also be specified in an Alias statement, and must not conflict with a web name.
31 Alias /foswiki/pub "/srv/http/htdocs/foswiki/pub"
32 Alias /foswiki/robots.txt "/srv/http/htdocs/foswiki/robots.txt"
36 # Rewriting is required for Short URLs, and Attachment redirecting to viewfile
38 #RewriteLog "/var/log/apache/rewrite.log"
44 Alias /foswiki "/srv/http/htdocs/foswiki/bin/view"
45 RewriteRule ^/+foswiki/+bin/+view/+(.*) /foswiki/$1 [L,NE,R]
46 RewriteRule ^/+foswiki/+bin/+view$ /foswiki/ [L,NE,R]
52 # This enables access to the documents in the Foswiki root directory
53 <Directory "/srv/http/htdocs/foswiki">
56 Deny from env=blockAccess
61 # This specifies the options on the Foswiki scripts directory. The ExecCGI
62 # and SetHandler tell apache that it contains scripts. "Allow from all"
63 # lets any IP address access this URL.
64 # Note: If you use SELinux, you also have to "Allow httpd cgi support" in your SELinux policies
66 <Directory "/srv/http/htdocs/foswiki/bin">
70 Deny from env=blockAccess
72 Options +ExecCGI +FollowSymLinks
75 # Password file for Foswiki users
76 AuthUserFile /srv/http/htdocs/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.'
80 # File to return on access control error (e.g. wrong password)
81 ErrorDocument 401 /foswiki/System/UserRegistration
83 # Limit access to configure to specific IP address(es) or user(s).
84 # Make sure configure is not open to the general public.
85 # It exposes system details that can help attackers.
86 # cf. http://foswiki.org/Support/ProtectingYourConfiguration for details.
87 <FilesMatch "^(configure)$">
89 # Require user foswiki # EDIT
91 ErrorDocument 401 default
96 # This sets the options on the pub directory, which contains attachments and
97 # other files like CSS stylesheets and icons. AllowOverride None stops a
98 # user installing a .htaccess file that overrides these options.
99 # Note that files in pub are *not* protected by Foswiki Access Controls,
100 # so if you want to control access to files attached to topics you need to
101 # block access to the specific directories same way as the ApacheConfigGenerator
102 # blocks access to the pub directory of the Trash web
103 <Directory "/srv/http/htdocs/foswiki/pub">
105 Options +FollowSymLinks
109 Deny from env=blockAccess
110 ErrorDocument 404 /foswiki/bin/viewfile
112 # This line will redefine the mime type for the most common types of scripts
113 AddType text/plain .shtml .php .php3 .phtml .phtm .pl .py .cgi
115 #add an Expires header that is sufficiently in the future that the browser does not even ask if its uptodate
116 # reducing the load on the server significantly
117 #IF you can, you should enable this - it _will_ improve your Foswiki experience, even if you set it to under one day.
118 # you may need to enable expires_module in your main apache config
119 #LoadModule expires_module libexec/httpd/mod_expires.so
120 #AddModule mod_expires.c
121 #<ifmodule mod_expires.c>
122 # <filesmatch "\.(jpe?g|gif|png|css(\.gz)?|js(\.gz)?|ico)$">
124 # ExpiresDefault "access plus 11 days"
128 # Serve pre-compressed versions of .js and .css files, if they exist
129 # Some browsers do not handle this correctly, which is why it is disabled by default
130 # <FilesMatch "\.(js|css)$">
132 # RewriteCond %{HTTP:Accept-encoding} gzip
133 # RewriteCond %{REQUEST_FILENAME}.gz -f
134 # RewriteRule ^(.*)$ %{REQUEST_URI}.gz [L,QSA]
136 # <FilesMatch "\.(js|css)\?.*$">
138 # RewriteCond %{HTTP:Accept-encoding} gzip
139 # RewriteCond %{REQUEST_FILENAME}.gz -f
140 # RewriteRule ^([^?]*)\?(.*)$ $1.gz?$2 [L]
142 # <FilesMatch "\.js\.gz(\?.*)?$">
143 # AddEncoding x-gzip .gz
144 # AddType application/x-javascript .gz
146 # <FilesMatch "\.css\.gz(\?.*)?$">
147 # AddEncoding x-gzip .gz
148 # AddType text/css .gz
154 # Security note: All other directories should be set so
155 # that they are *not* visible as URLs, so we set them as =deny from all=.
156 <Directory "/srv/http/htdocs/foswiki/data">
160 <Directory "/srv/http/htdocs/foswiki/templates">
164 <Directory "/srv/http/htdocs/foswiki/lib">
168 <Directory "/srv/http/htdocs/foswiki/locale">
172 <Directory "/srv/http/htdocs/foswiki/tools">
176 <Directory "/srv/http/htdocs/foswiki/working">
180 # We set an environment variable called blockAccess.
182 # Setting a BrowserMatchNoCase to ^$ is important. It prevents Foswiki from
183 # including its own topics as URLs and also prevents other Foswikis from
184 # doing the same. This is important to prevent the most obvious
185 # Denial of Service attacks.
187 # You can expand this by adding more BrowserMatchNoCase statements to
188 # block evil browser agents trying to crawl your Foswiki
191 # BrowserMatchNoCase ^SiteSucker blockAccess
192 # BrowserMatchNoCase ^$ blockAccess
196 BrowserMatchNoCase ^$ blockAccess