麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 網站 > Nginx > 正文

在ubuntu下為nginx配置支持cgi腳本的方案

2024-08-30 12:28:35
字體:
來源:轉載
供稿:網友

在nginx下支持cgi腳本于支持node類似的,只要在nginx直接做個轉發,轉發到對應的cgi套接字就好。

使用Fcgiwrap

Fcgiqwrap是另外一個CGI封裝庫,跟Simple CGI類似。

安裝fcgiwrap

apt-get install fcgiwrap

安裝以后fcgiwrap默認已經啟動,對應的套接字是 /var/run/fcgiwrap.socket 。如果沒有啟動,使用 /etc/init.d/fcgiwrap 手動啟動。

配置nginx的vhost文件

在要支持cgi腳本的路徑下,添加對應的server配置。比如所有的cgi都在cgi-bin路徑下:

server {[...]  location /cgi-bin/ {   # Disable gzip (it makes scripts feel slower since they have to complete   # before getting gzipped)   gzip off;   # Set the root to /usr/lib (inside this location this means that we are   # giving access to the files under /usr/lib/cgi-bin)   root /var/www/www.example.com;   # Fastcgi socket   fastcgi_pass unix:/var/run/fcgiwrap.socket;   # Fastcgi parameters, include the standard ones   include /etc/nginx/fastcgi_params;   # Adjust non standard parameters (SCRIPT_FILENAME)   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  }[...]}

重新加載nginx:

nginx -s reload

測試

在cgi-bin下創建hello-world.cgi

#!/usr/bin/perl -w   # Tell perl to send a html header.   # So your browser gets the output   # rather then <stdout>(command line   # on the server.)print "Content-type: text/html/n/n";   # print your basic html tags.   # and the content of them.print "<html><head><title>Hello World!! </title></head>/n";print "<body><h1>Hello world</h1></body></html>/n";

設置執行權限

chmod 755 /var/www/www.example.com/cgi-bin/hello_world.cgi

在瀏覽器打開對應腳本,即可看到已經配置成功! http://www.example.com/cgi-bin/hello_world.cgi


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 久久免费视频3 | 55夜色66夜色国产精品视频 | 国产在线精品区 | 国外成人在线视频 | 久草成人在线 | 99视频有精品视频高清 | 亚洲视频精选 | 极品xxxx欧美一区二区 | 精品一区二区免费 | 免费视频一区 | 国产精品久久久久久久久久10秀 | 欧美 国产 综合 | 国产1区2 | 中文字幕在线免费看 | 亚洲人成免费 | 久草视频国产在线 | 成人一区二区三区四区 | 九一国产精品 | 欧美成年人在线视频 | 久久欧美亚洲另类专区91大神 | 国产精品久久久久久久不卡 | 91网站免费观看 | 一级免费黄色免费片 | 国语自产免费精品视频在 | 国产精品久久久久久久久久大牛 | 91久久精品一| 一级做a爱片久久毛片a高清 | 国产精品亚洲一区二区三区久久 | 成人做爽爽爽爽免费国产软件 | a级毛片免费观看在线播放 日本aaa一级片 | av在线一区二区三区四区 | 欧美一级做一a做片性视频 日韩黄色片免费看 | 中文字幕在线看第二 | 5xsq在线视频 | 噜噜噜在线 | 亚洲成人福利在线观看 | 久久久久成人免费 | 欧美一级性 | 视频一区二区不卡 | 国产精品99久久久久久大便 | 欧美日韩国产一区二区三区在线观看 |