在Nginx服务器下运行Movable Type
由于Nginx没有对CGI的原生支持,但是他同样还是可以运行类似Movable Type这样的程序(包括其它的一些基于CGI的程序),我们要使用到的中具就是 *fcgiwrap*,它就像是一个代理一样,把FCGI请求转发为CGI请求,所以,使用它,我们不需要修改一行程序代码。
首先需要安装 fcgiwrap:
root@CoxStation:~# aptitude install fcgiwrapfcgiwrap* 可以以一个系统守护进程运行,并以一个Unix Socket文件访问(/var/run/fcgiwrap.socket)。现在我想让Movable Type的管理端通过 http://mt.csmumu.net访问到,下面这个就是完整的 server 配置代码。
server {
server_name mt.csmumu.net;
access_log /home/cox/logs/mt.csmumu.net.access.log;
error_log /home/cox/logs/mt.csmumu.net.error.log;
root /home/cox/websites/mt.csmumu.net/public;
location ~ ^/mt.*.cgi {
## The exact pattern is required for MT.
fastcgi_split_path_info ^(/mt.*.cgi)(.*)$;
include fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
## MT-related
fastcgi_param PERL5LIB $document_root/lib;
fastcgi_param MT_HOME $document_root/;
fastcgi_param MT_CONFIG $document_root/mt-config.cgi;
## fcgiwrap-related
fastcgi_param SCRIPT_NAME $document_root$fastcgi_script_name";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name";
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
}
}
评论已关闭