# trouble with nginx & fcgiwrapper (trying to setup OpenXPKI)



## spacebass (Nov 3, 2020)

Hey folks,
I'm trying to get OpenxPKI working on 12.1.
;tldr: looks like the package's fcgi scripts are accessed but not executed

First, for others finding this thread later, here are some commonly found search results on OpenXPKI installs
* Debian similar issue: https://sourceforge.net/p/openxpki/mailman/message/32882326/
* Pkg maintainer's guide on GitHub: https://github.com/openxpki/openxpki/blob/develop/package/freebsd/README-FREEBSD.TXT

*working*:
- nginx starts, serves some pages
- OpenXPKI command line and server start
- fcgi starts

*issue*:
When I try and load the OpenXPKI page, the page loads but gives me an application error. When I watch the access logs, I see the scripts are accessed in /cgi-bin/ and return a 200. But when I watch the OpenXPKI application log, the scripts aren't actually executed. (EG: if I call a script from the command line, the application logs light up, if I call them from the web nothing appears)

nginx conf

```
location /openxpki {
index index.html;
root /usr/local/www/nginx/openxpki;
}
location /cgi-bin/ {
allow all;
gzip off;
root /usr/local/www/nginx/cgi-bin;
include /usr/local/etc/nginx/fastcgi_params;
fastcgi_pass unix:/tmp/fcgiwrap.socket;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
```

rc.conf

```
fcgiwrap_enable="YES"
fcgiwrap_socket="unix:/tmp/fcgiwrap.socket"
fcgiwrap_user="www"
fcgiwrap_socket_owner="www"
fcgiwrap_socket_group="www"
```


*ownerships*

```
srwxrwxr-x 1 www www 0B Nov 2 20:09 /tmp/fcgiwrap.socket
```

*➜ nginx ls -alh /usr/local/www/nginx/*
total 32

```
dr-xr-xr-x 5 root wheel 512B Nov 2 16:17 .
drwxr-xr-x 6 root wheel 512B Nov 2 15:38 ..
-rw-r--r-- 1 root wheel 494B Apr 21 2020 50x.html
-rw-r--r-- 1 root wheel 0B Oct 3 22:48 EXAMPLE_DIRECTORY-DONT_ADD_OR_TOUCH_ANYTHING
drwxr-xr-x 2 www www 512B Nov 2 15:53 cgi-bin
-rw-r--r-- 1 root wheel 612B Apr 21 2020 index.html
-rw-r--r-- 1 root wheel 20B Aug 11 08:14 info.php
drwxrwxr-x 11 root www 512B Aug 11 08:24 lam
drwxr-xr-x 6 www www 512B Nov 2 19:51 openxpki
```

*➜ cgi-bin ls -alh*
total 76

```
drwxr-xr-x 2 www www 512B Nov 2 15:53 .
dr-xr-xr-x 5 root wheel 512B Nov 2 16:17 ..
-rwxr-xr-x 1 www www 4.6K Nov 2 15:53 download.fcgi
-rwxr-xr-x 1 www www 10K Nov 2 15:53 est.fcgi
-rwxr-xr-x 1 www www 23K Nov 2 15:53 rpc.fcgi
-rwxr-xr-x 1 www www 7.1K Nov 2 15:53 scep.fcgi
-rwxr-xr-x 1 www www 744B Nov 2 15:53 soap.fcgi
-rwxr-xr-x 1 www www 9.2K Nov 2 15:53 webui.fcgi
```

I'd be grateful for any troubleshooting tips or ideas this group has. Thanks so much!


----------

