I need to configure CGI on Apache Web Server, running on NIxOS. I have successfully loaded CGI module into Apache, but I can’t access scripts, which CGI have to execute.
.htaccess files are mainly for people who don’t have access to the Apache config. You’re the sysadmin in this situation so you don’t need a .htaccess file. Can you let know what you’re trying to do and what nix configuration you have so far?
As you can see, /var/cgi/scripts is aliased to https://mydomain.com/cgi-bin/
Let’s assume, that I have hello shell script, that placed in /var/cgi/scripts I need this script to be executed, when I open https://mydomain.com:1256/cgi-bin/hello, but instead, I receive 403 HTTP response.
I ensured, that /var/cgi/scripts belongs to wwwrun user.
When I’m trying to trigger helloscript, I’m getting this message in apache error log
[Thu Nov 12 15:58:21.801910 2020] [authz_core:error] [pid 8915:tid 139815394662144] [client xx.xx.xx.xx:xxxxx] AH01630: client denied by server configuration: /var/cgi/scripts
make sure index.pl (or whatever your cgi program is) has executable bit set
make sure your scripts directory has an apache<Directory> directive with Require all granted (or equivalent, depending on your needs)
under no situation ever should you or anyone use the systemd.tmpfiles.rules hack I have written here, other than for a disposable VM test if the apache configuration alone I provided doesn’t work
Thanks for the solution. Unfortunately, it does not seems to worrk for me. I’ve rewritten my config, to include those solution, you provided me. Here’s what I have now: