FastCGI结合docker下的Nginx执行shell脚本

1 使用docker下载Nginx

下面展示一些 内联代码片
a.

# docker pull nginx
# docker run --name runoob-php-nginx -p 8088:80 -d \
    -v ~/nginx/www:/usr/share/nginx/html:ro \
    -v ~/nginx/conf/conf.d:/etc/nginx/conf.d:ro \
    nginx

b.
在~/nginx/conf/conf.d创建配置文件nginx.conf
server {
listen 80;
charset utf-8;
location / {
root /usr/share/nginx/html;
index index.html index.cgi;
}
location ~ .*.cgi$ {
root /usr/share/nginx/html;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/local/docker/nginx/www/$fastcgi_script_name;
fastcgi_index index.cgi;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
}

2 下载fcgiwrap

# aptitude install fcgiwrap
# cp /usr/share/doc/fcgiwrap/examples/nginx.conf /etc/nginx/fcgiwrap.conf
在配置文件中加入include /etc/nginx/fcgiwrap.conf;

3 在~/nginx/www目录下创建index.cgi即可

你可能感兴趣的:(nginx,docker)