Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
514 views
in Technique[技术] by (71.8m points)

nginx - How to hide ".py" ".cgi" ".pl" in my URLs?

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;
  }
}
question from:https://stackoverflow.com/questions/66062556/how-to-hide-py-cgi-pl-in-my-urls

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...