配置DSPAM WebUI支持Nginx,修改了原文dspam虚拟主机小部分配置 一、配置Nginx nginx的安装这里就不在介绍。1、配置DSPAM虚拟主机: # vi /etc/nginx/conf.d/vhost_dspam.conf内容如下: server { listen 80; server_name dspam.extmail.org; access_log /var/log/dspam/access.log; error_log /var/log/dspam/error.log; root /usr/share/dspam/webui/cgi-bin; index dspam.cgi; location ~ \.cgi$ { gzip off; fastcgi_pass 127.0.0.1:8899; fastcgi_index dspam.cgi; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param REMOTE_USER $remote_user; auth_basic "DSPAM Restricted Site"; auth_basic_user_file /usr/share/dspam/webui/cgi-bin/.htpasswd; include /etc/nginx/fcgi.conf; } } 2、编辑fcgi.conf文件 # vi /etc/nginx/fcgi.conf 内容如下: fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; 3、修改dspam_webui的配置文件 # cp /usr/share/dspam/webui/htdocs/* /usr/share/dspam/webui/cgi-bin/ # vi /usr/share/dspam/webui/cgi-bin/configure.pl 修改内容如下: $CONFIG{'WEB_ROOT'} = "./"; 二、配置FCGI 配置Nginx支持perl FCGI perl-cgi脚本参考nginx官方文档,网上也有很多这方面的脚本下载 http://wiki.nginx.org/SimpleCGI 1、安装perl FCGI # perl -MCPAN -e 'install FCGI::ProcManager' # wget http://blog.dspam.org.cn/mail/cgiwrap-fcgi.pl.tgz -P /usr/local/bin/ # cd /usr/local/bin/ # tar zxvf cgiwrap-fcgi.pl.tgz # chmod +x cgiwrap-fcgi.pl # ./cgiwrap-fcgi.pl > /dev/null 2>&1 & # vi /etc/rc.local 添加以下内容: /usr/local/bin/cgiwrap-fcgi.pl > /dev/null 2>&1 & 备注: 如果非EMOS环境或没有安装perl-FCGI的,请用下面办法自行安装 # perl -MCPAN -e 'install FCGI' 2、启动Nginx服务 # service httpd stop # service dspam-webd stop # chkconfig httpd off # chkconfig dspam-webd off # service nginx start # chkconfig nginx on 三、备注:配置extmail虚拟主机 1、配置extmail虚拟主机 # vi /etc/nginx/conf.d/vhost_extmail.conf 内容如下: server { listen 80; server_name mail.extmail.org; index index.html index.htm index.php index.cgi; root /var/www/extsuite/extmail/html; access_log /var/log/extmaillog.log; location /extmail/cgi { fastcgi_pass 127.0.0.1:8888; fastcgi_index index.cgi; include /etc/nginx/fcgi.conf; } location /extmail { alias /var/www/extsuite/extmail/html/; } location /extman/cgi { fastcgi_pass 127.0.0.1:8888; fastcgi_index index.cgi; include /etc/nginx/fcgi.conf; } location /extman { alias /var/www/extsuite/extman/html/; } } 2、启动服务 # /usr/sbin/nginx -s reload # /var/www/extsuite/extmail/dispatch-init start # vi /etc/rc.local 添加以下内容: /var/www/extsuite/extmail/dispatch-init start (责任编辑:IT) |