# Twiki with nginx and fastcgi/perl



## viniciusferrao (Jun 24, 2014)

Hello guys,

I'm trying to install www/twiki using www/nginx and www/fcgiwrap but it fails with a 403 error when I try to configure the system through the web configure in: http://mytwikiserver.example.com/bin/configure

I've checked the `nginx` logs, and there's  no errors. I think something is wrong with `fcgiwrap` but I'm unable to debug the issue.

Here are some configuration files that could help solving the problem:

/etc/rc.conf

```
#Twiki Settings
nginx_enable="YES"
fcgiwrap_enable="YES"
fcgiwrap_user="www"
```

/usr/local/etc/nginx/nginx.conf

```
#user  nobody;
worker_processes  2;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  twiki.example.com www.twiki.example.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /usr/local/www/twiki-lape;
            index  index.html index.htm;
        }


	location ~ ^/ {

	    rewrite ^/([A-Z].*)  /bin/view/$1;
	    rewrite ^/edit/(.*)  /bin/edit/$1;

#	    deny all;
	    allow all;

	    location ~ ^/pub/ { allow all; }

	    location ~ ^/bin/configure {
	    #allow          192.168.0.1; # When you configure your TWiki, remove "#" and set your IP address.
            allow all;
	    fastcgi_pass   unix:/var/run/fcgiwrap/fcgiwrap.sock;
            include        fastcgi_params;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    	}

    	location ~ ^/bin/ {
        	allow all;
	        fastcgi_pass   unix:/var/run/fcgiwrap/fcgiwrap.sock; 
	        fastcgi_split_path_info  ^(/bin/[^/]+)(/.*)$;
	        include        fastcgi_params;
	        fastcgi_param  PATH_INFO        $fastcgi_path_info;
	        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    	}
}

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/local/www/nginx-dist;
        }

    }

}
```

And finally, installed packages on the system:

```
fcgi-devkit-2.4.0              FastCGI Development Kit
fcgiwrap-1.1.0                 Simple FastCGI wrapper for CGI scripts
gettext-0.18.3.1_1             GNU gettext package
nginx-1.6.0_1,2                Robust and small WWW server
p5-Algorithm-Diff-1.1902       Perl interface to compute differences between two objects
p5-Archive-Tar-2.00            Perl module for creation and manipulation of tar files
p5-Archive-Zip-1.37            Perl module to create, manipulate, read, and write Zip archive files
p5-Authen-NTLM-1.09            Perl5 NTLM authentication module
p5-CGI-Session-4.48            Perl extension for persistent session management
p5-Data-Dump-1.22              Pretty printing of data structures
p5-Digest-HMAC-1.03            Perl5 interface to HMAC Message-Digest Algorithms
p5-Digest-SHA1-2.13            Perl interface to the SHA-1 Algorithm
p5-Encode-Locale-1.03          Determine the locale encoding
p5-Error-0.17022               Error/exception handling in object-oriented programming style
p5-FCGI-0.74                   Modules for perl5, for enabling FastCGI support in CGI scripts
p5-File-Listing-6.04           Parse directory listings
p5-HTML-Parser-3.71            Perl5 module for parsing HTML documents
p5-HTML-Tagset-3.20            Some useful data table in parsing HTML
p5-HTTP-Cookies-6.01           HTTP Cookie jars
p5-HTTP-Daemon-6.01            Simple HTTP server class
p5-HTTP-Date-6.02              Conversion routines for the HTTP protocol date formats
p5-HTTP-Message-6.06_2         Representation of HTTP style messages
p5-HTTP-Negotiate-6.01         Implementation of the HTTP content negotiation algorithm
p5-IO-HTML-1.00                Open an HTML file with automatic charset detection
p5-IO-Socket-IP-0.29           Drop-in replacement for IO::Socket::INET supporting IPv4 and IPv6
p5-IO-Socket-SSL-1.993         Perl5 interface to SSL sockets
p5-IO-String-1.08              Simplified Perl5 module to handle I/O on in-core strings
p5-LWP-MediaTypes-6.02         Guess media type for a file or a URL
p5-Locale-Maketext-1.23        Framework for software localization and inheritance-based lexicons
p5-Locale-Maketext-Lexicon-0.99 Use other catalog formats in Locale::Maketext
p5-Net-HTTP-6.06               Low-level HTTP client
p5-Net-SSLeay-1.64             Perl5 interface to SSL
p5-Socket-2.014                Networking constants and support functions
p5-Text-Diff-1.41              Text::Diff - Perform diffs on files and record sets
p5-URI-1.60                    Perl5 interface to Uniform Resource Identifier (URI) references
p5-WWW-RobotRules-6.02         Database of robots.txt-derived permissions
p5-libwww-6.06                 Perl5 library for WWW access
pcre-8.34_1                    Perl Compatible Regular Expressions library
perl5-5.16.3_11                Practical Extraction and Report Language
pkg-1.2.7_3                    Package manager
python27-2.7.6_4               Interpreted object-oriented programming language
twiki-5.1.4,1                  Flexible, powerful, and easy to use enterprise wiki
twiki-TWikiUserMappingContrib-0.0.17569 Traditional topic-based user mapping and management
vim-lite-7.4.316               Improved version of the vi editor (lite package)
xe-guest-utilities-6.0.2_2     FreeBSD VM tools for Citrix XenServer and XCP
xen-tools-4.1.3_3              Xen tools within FreeBSD domU
```

Thanks in advance,


----------



## oleg_skat (Dec 26, 2014)

Hi viniciusferrao.
Got a similar problem.
I'd like to ask you, what result do you have? Did you write  to software authors?
Does the fcgiwrap work?


----------



## viniciusferrao (May 8, 2016)

oleg_skat said:


> Hi viniciusferrao.
> Got a similar problem.
> I'd like to ask you, what result do you have? Did you write  to software authors?
> Does the fcgiwrap work?



We given up of using Twiki and just started using MediaWiki instead.


----------

