Answer the question
In order to leave comments, you need to log in
How to correctly register a config for a directory with a CGI script?
There is a /srv/http directory:
├── test.db
├── test.sh
└── styles
└── style.css
test.sh
, of course, makes up an html page that reads the stylesheet styles/style.css
. The script must be executed when called, for example, localhost . Also, the script must read the address bar parameters and process them. So localhost/shit , localhost/fuck , localhost/cringe nginx should be passed to the script, while localhost/styles should be treated as a directory so that html can read the styles properly. server {
listen 80;
root /srv/http;
index test.sh;
server_name localhost;
charset utf-8;
location /styles/ {
location ~ \.(?:jpg|jpeg|gif|png|ico|css|js)$ {
log_not_found off;
expires 90d;
gzip on;
gzip_types text/plain text/css application/x-javascript text/javascript;
gzip_static on;
gzip_http_version 1.1;
gzip_comp_level 8;
}
return 404;
}
location / {
fastcgi_split_path_info ^(.+?\.sh)(/.*)$;
fastcgi_pass unix:/run/fcgiwrap.sock;
fastcgi_index test.sh;
include fastcgi_params;
}
}
Answer the question
In order to leave comments, you need to log in
nginx basically doesn't know CGI.
So you need something that will work on the fastcgi/http protocol and run the script. For example https://www.nginx.com/resources/wiki/start/topics/...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question