You are here: Sandbox » NginxConfiguration

Nginx Config Generator

This page creates an Apache configuration file foswiki.conf for your installation. (See Help with this page if you don't understand some of the terminology used here.)
  1. Select your Foswiki and Apache version, and fill out the form.
  2. Press the "Update Config File" button
  3. Copy and paste the generated configuration into a new file in the same directory as httpd.conf
  4. Add a line to httpd.conf so Apache loads the new configuration file (e.g. Include conf/foswiki.conf)
    • Note that the exact method of including a configuration file can vary by os and distribution. Consult your local apache documentation.

For setting up Middle Fork Home Wiki on Linux or Unix, see also SettingFileAccessRightsLinuxUnix.

  • Windows Users: enter all file paths using linux forward-slash style, like C:/www/foswiki. Don't use Windows style back-slash in the paths.
  • Using a web hosting service and can't configure Apache? Do not bother using this page - edit the various .htaccess template files. See details in the installation guide.

Foswiki version

Generate configuration for Foswiki version
  • Selecting 2.x will drop Apache protection for bin/configure.

Apache "Name based" virtual hosts (optional)

Complete this section to define an Apache virtual host eg: (<VirtualHost *:80>). Enter the qualified hostname, otherwise leave blank. You can also enter an optional port number. (Port not needed on most systems) Example: foswiki.myhost.com If you are not defining an Apache "Virtual Host", leave hostname and port blank.

Host Name: (optional) Port: (optional)

Apache timers

Enter the timeout in seconds for the maximum runtime of a foswiki transaction. (Any request exceeding this time will result in a 500 error to the user. Leave empty to take apache system default.)
TimeOut: (optional)

File system paths

Enter the full file path to your foswiki root directory: Foswiki does not work with directory names containing spaces (especially important to notice for Windows users). So choose an installation directory without spaces.
Path: (mandatory, no spaces)

Will you require Symbolic Links in the pub/ or bin/ directories?
(optional)

URL information

Enter the url path which foswiki is accessed :
(For shortest URL's, you can enter only the slash).
URL Path: (mandatory)

Short URLs

When you enable this, you can omit the bin/view/ from the URLs. Use domain.tld/foswiki/Web/Topic instead of the normal domain.tld/foswiki/bin/view/Web/Topic
Enabled
Disabled

Runtime engine

Choose the way foswiki is supposed to run (see FoswikiStandAlone). Select CGI if in doubt.
CGI
FastCGI
mod_perl

FastCGI module: mod_fcgid mod_fastcgi

Enter the maximum size of any data transmitted from the client to the Foswiki process. (Any request exceeding this size will result in error 500 to the user. Leave empty to take fcgid system default of 131072 bytes.) This should be larger than the largest ATTACHFILESIZELIMIT preference setting, Multiply ATTACHFILESIZELIMIT by 1024. Default of 10000k is 10240000 bytes.
FcgidMaxRequestLen: (optional)

Apache version: 1.x 2.x

Before you enable mod_perl in your webserver, you have to configure Foswiki. Otherwise, you'll face a chicken-and-egg problem, and would get something like this in your Apache error logs:
[error] Content-type: text/plain\n\nPerl error when reading LocalSite.cfg: \nPlease inform the site admin.\nBEGIN failed--
You will also have to generate a suitable mod_perl_startup.pl script for use with this configuration. See ModPerlStartup for guidance.
Before you enable fastcgi in your webserver, you should install the FastCGIEngineContrib using the Extensions: Install and update Extensions tool. The server will run, but all of the Foswiki scripts will fail with foswiki.fcgi not found until the Extension is installed.

SSL Configuration information

Only enable SSL if your server is not already configured for SSL, or this is a new virtual host that needs SSL

Enable SSL (https): (optional)

The certificate file should have it's password removed or Apache will prompt for a password when started.

Location of the SSL Certificate file:
(required)

Some Certificate Authorities will provide a CA Chain file. Provide the fully qualified filename here if required, otherwise blank out this field.

Location of the SSL Certificate CA Chain file:
(optional)

Provide the Certificate private key file location if the key is separated from the certificate. If private key is embedded in the certificate file, blank out this field.

Location of the SSL Certificate Private key file:
(optional)

Foswiki login support

Choose your Login Manager:
None - No login
TemplateLogin - Redirect to the login template, which asks for a username and password in a form
ApacheLogin - Apache is configured to ask for authorization information

Location of directory containing the .htpasswd file:
(optional - if blank, defaults to "/var/www/foswiki/data" omit trailing slash.)

Page to return when authentication fails:
UserRegistration
ResetPassword
None. Use Apache default 401 message
Custom: (enter Web/TopicName )

Attachments

PHP execution

Prevent execution of attached files as PHP scripts if PHP is installed:

Attachment access protection

Block direct access to viewing attachments that ends with .htm or .html:
Check to block access: (recommended against spam abuse)

Block direct access to viewing attachments in Trash web
Check to block access: (recommended against spam abuse)

Apply Foswiki access controls to attachments by redirecting access to the viewfile script?
Check to control attachment access: Caution: Slows performance significantly when enabled!

In some installations it is important to protect attached files with the same access controls that are applied to the owning topic. If this option is selected, the configuration will include some rewrite rules that redirect web access to attachments to the bin/viewfile script.
  • Note that this option can have a significant impact on performance.
  • Also, this option is incompatible with ImageGalleryPlugin as it writes to /pub/images which is not a valid web name.
  • Viewfile sets the mime type based upon file name suffix. Unknown types are served as text/plain which can result in corrupt files.
  • This option will also add some rewrite rules that bypass viewfile for certain graphics files - review the comments in the configuration carefully!

Spiders and Robots

Do you want to include rules to block access from well known robot agents? Note, the default list includes well known robots including Google.
Check to deny access: (Recommended for public sites)

default foswiki.conf

Press the "Update config file" button to generate your custom config

By pressing the button below you select all the text in the textarea. Then you just need to copy the text to the clipboard and paste it into the foswiki.conf file.
Copy text below to tools/foswiki.defaults to /etc/default/foswiki, and tailor it for your installation. If your distribution does not use etc/default files, then these settings need to be manually inserted into the init script.


Depending on the configuration you might get an error in Apache leading to a non-working configuration:
Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/foswiki/bin/configure
In this case you should think about your redirection policy. One fix is to add the line
Options +FollowSymLinks
to the configuration which applies to the base directory of the path mentioned in the error message (either as htaccess or conditional in apache .conf)

Comments

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Middle Fork Home Wiki? Send feedback
Syndicate this site RSS