0

I have Nginx server up and running, I am trying to host a CGI script, so, it is hosted at

https://sub.domain.com/index.cgi

instead, I want it like

https://sub.domain.com/

Here is my current Nginx Config:

server {
  listen   80;
  server_name  sub.domain.com;

  location / {
    add_header Access-Control-Allow-Origin *;
    root /home/user/folder;
    index index.html;
  }

  location ~ (\.cgi|\.py|\.sh|\.pl|\.lua)$ {
    index index.html;
    gzip off;
    root /home/user/folder;
    autoindex on;
    fastcgi_pass unix:/var/run/fcgiwrap.socket;
    include /etc/nginx/fastcgi_params;
    fastcgi_param DOCUMENT_ROOT /home/user/folder;
    fastcgi_param SCRIPT_FILENAME /home/user/folder/index.cgi;
  }
}
  • 1
    Your question title is about hiding `.cgi` but the body of the question is about hiding `index.cgi`. You can do the latter by replacing your `index` statements with `index index.cgi index.html;` – Richard Smith Feb 05 '21 at 11:42
  • It works now, earlier it showed 502 error code – Dhruv Suthar Feb 05 '21 at 11:55

0 Answers0