Before configuring bugzilla, you need to install the epel library and the rpmforge library.
nginx itself does not have the function of perl analysis, need to use fcgi-perl, install:
yum install fcgi-perl
Write a script fastcgi service script:
vim /usr/local/fcgi-perl/fastcgi-wrapper.pl
#!/usr/bin/perl
use FCGI;
use Socket;
use POSIX qw(setsid);
require ‘syscall.ph’;
&daemonize;
#this keeps the program alive or something after exec’ing perl
scripts
END() { } BEGIN() { }
*CORE::GLOBAL::exit = sub { die “fakeexit\nrc=”.shift().”\n”;
};
eval q{exit};
if ($@) {
exit unless $@ =~ /^fakeexit/;
};
&main;
sub daemonize() {
chdir
‘/’
or die “Can’t chdir to /: $!”;
defined(my $pid = fork) or die
“Can’t fork: $!”;
exit if $pid;
setsid
or die “Can’t start a new session: $!”;
umask 0;
}
sub main {
$socket =
FCGI::OpenSocket( “127.0.0.1:8999”, 10 ); #use IP sockets
$request =
FCGI::Request( \*STDIN, \*STDOUT, \*STDERR, \%req_params, $socket
);
if ($request) {
request_loop()};
FCGI::CloseSocket( $socket );
}
sub request_loop {
while(
$request->Accept() >= 0 ) {
#processing any STDIN input from WebServer (for CGI-POST
actions)
$stdin_passthrough = ”;
$req_len = 0 + $req_params{‘CONTENT_LENGTH’};
if
(($req_params{‘REQUEST_METHOD’} eq ‘POST’) && ($req_len !=
0) ){
my $bytes_read = 0;
while ($bytes_read <$req_len) {
my $data = ”;
my $bytes = read(STDIN, $data, ($req_len – $bytes_read));
last if ($bytes == 0 || !defined($bytes));
$stdin_passthrough .= $data;
$bytes_read += $bytes;
}
}
#running the cgi app
if ( (-x $req_params{SCRIPT_FILENAME}) && #can I
execute this?
(-s $req_params{SCRIPT_FILENAME}) && #Is this file
empty?
(-r $req_params{SCRIPT_FILENAME}) #can I
read this file?
){
Pipe(CHILD_RD,
PARENT_WR);
my $pid =
open(KID_TO_READ, “-|”);
unless(defined($pid))
{
print(“Content-type: text/plain\r\n\r\n”);
print “Error: CGI app returned no output – “;
print “Executing $req_params{SCRIPT_FILENAME} failed !\n”;
next;
}
if ($pid > 0) {
close(CHILD_RD);
print PARENT_WR $stdin_passthrough;
close(PARENT_WR);
while(my $s = ) { print $s; }
close KID_TO_READ;
waitpid($pid, 0);
} else {
foreach $key (keys %req_params){
$ENV{$key} = $req_params{$key};
}
# cd to the script’s local directory
if ($req_params{SCRIPT_FILENAME} =~ /^(.*)\/[^\/]+$/) {
chdir $1;
}
close(PARENT_WR);
close(STDIN);
#fcntl(CHILD_RD, F_DUPFD, 0);
syscall(&SYS_dup2, fileno(CHILD_RD), 0);
#open(STDIN, “<&CHILD_RD");
exec($req_params{SCRIPT_FILENAME});
die(“exec failed”);
}
}
else {
print(“Content-type: text/plain\r\n\r\n”);
print “Error: No such CGI app – $req_params{SCRIPT_FILENAME} may
not “;
print “exist or is not executable by this process.\n”;
}
}
}
Make it run as a service:
vim /etc/init.d/perl-fastcgi
#!/bin/sh
#
# nginx ? this script starts and stops the nginx daemon
#
# chkconfig: -85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /opt/nginx/conf/nginx.conf
# pidfile: /opt/nginx/logs/nginx.pid
# Source function library.
./etc/rc.d/init.d/functions
# Source networking configuration.
./etc/sysconfig/network
# Check that networking is up.
[ “$NETWORKING” = “no” ] && exit 0
perlfastcgi=”/usr/local/fcgi-perl/fastcgi-wrapper.pl”
prog=$(basename perl)
lockfile=/var/lock/subsys/perl-fastcgi
start() {
[ -x $perlfastcgi ] || exit 5
echo -n $”Starting $prog: “
daemon $perlfastcgi
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $”Stopping $prog: “
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
force_reload() {
restart
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case “$1” in
start)
rh_status_q &&
exit 0
$1
;;
stop)
rh_status_q || exit
0
$1
;;
restart)
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit
0
;;
*)
echo $”Usage: $0
{start|stop|status|restart|condrestart|try-restart|force-reload}”
exit 2
esac
Change permissions and start:
chmod 755 /etc/init.d/perl-fastcgi
chmod 755 /usr/local/fcgi-perl/fastcgi-wrapper.pl
chkconfig –add perl-fastcgi
chkconfig –level 345 perl-fastcgi on
service perl-fastcgi start
After starting, you can use ps or netstat to see if the process and port are up.
I won’t talk about the installation of nginx, configure a host used by bugzilla in nginx:
server {
listen 80;
“ server_name`
bugzilla.domainname.com;
root
/usr/local/nginx/html/bugzilla;
index index.cgi
index.pl index.html index.htm;
access_log
/usr/local/nginx/html/bugzilla/logs/access.log combined;
error_log
/usr/local/nginx/html/bugzilla/logs/error.log notice;
# location / {
#
root /usr/local/nginx/html/bugzilla;
#
index index.html index.htm;
# }
location ~
.*\.(pl|cgi)$ {
root
/usr/local/nginx/html/bugzilla;
gzip off;
include fastcgi_params;
fastcgi_pass 127.0.0.1:8999;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME
/$document_root/$fastcgi_script_name;
}
}
Application Configuration:
service nginx reload
First write a test script and run it to see if it is normal:
vim /usr/local/nginx/html/bugzilla/test.pl
#!/usr/bin/perl
print “Content-type: text/html\n\n”;
print <<EndOfHTML;
Perl Environment Variables
EndOfHTML
foreach $key (sort(keys %ENV)) {
print “$key = $ENV{$key}
\n”;
}
print “”;
After saving, you need to change the permissions:
chmod 755 /usr/local/nginx/html/bugzilla/test.pl
Then use a browser to visit this page to see if it is running normally.
After no problem, even if the fcgi-perl environment is configured, install bugzilla below:
cd /usr/local/nginx/html/bugzilla
wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-4.4.tar.gz
tar -xvzf bugzilla-4.4.tar.gz
mv bugzilla-4.4/* /usr/local/nginx/html/bugzilla/
cd web
Before installation, check whether all the modules required by bugzilla are installed:
./checksetup.pl –check-modules
If not installed, use the following method to install:
yum –disablerepo=epel install perl-DateTime
perl-DateTime-TimeZone perl-DBI perl-Template-Toolkit
perl-Template-Toolkit perl-Email-Send perl-Email-MIME perl-URI
perl-List-MoreUtils perl-DBD-Pg perl-DBD-Oracle
perl-GD perl-Chart perl-Template-GD perl-GDTextUtil
perl-GDGraph perl-MIME-tools perl-libwww-perl perl-XML-Twig
perl-PatchReader perl-LDAP perl-Authen-SASL perl-RadiusPerl
perl-SOAP-Lite JSON-RPC perl-JSON-XS perl-Test-Taint
perl-HTML-Parser perl-HTML-Scrubber
perl-Email-MIME-Attachment-Stripper perl-Email-Reply
perl-TheSchwartz perl-Daemon-Generic Math-Random-Secure
again with ./checksetup.pl
–check-modules check, found that there are still a few packages not installed, prompting to install with the following command, but I have been unable to install after executing:
/usr/bin/perl install-module.pl JSON::RPC
/usr/bin/perl install-module.pl Apache2::SizeLimit
/usr/bin/perl install-module.pl Math::Random::Secure
/usr/bin/perl install-module.pl Email::MIME
Then you don’t need bugzilla to install the module, install it yourself:
perl -MCPAN -e “install Email::MIME”
perl -MCPAN -e shell
cpan>force install JSON::RPC
cpan>force install Math::Random::Secure
Last check, it should be ok.
Edit the configuration file and fill in the directory, database ip, library name, user and password.
vim localconfig
Then you can officially install:
./checksetup.pl
You will be prompted to enter an email address and password, which is the default administrator user and password.
After installation, open the browser to see if it is normal.
In addition, the database needs to be optimized, add the following two lines:
[mysqld]
max_allowed_packet=4M
ft_min_word_len=2
Restart the database after making changes.
Install the Traditional Chinese package:
http://code.google.com/p/bugzilla-tw/
wget http://code.google.com/p/bugzilla-tw/downloads/detail?name=bugzilla.zh-TW.4.4r.20130609.tar.gz
tar -xvzf bugzilla.zh-TW.4.4r.20130609.tar.gz
cp -rf bugzilla-tw/template/zh-TW
/usr/local/nginx/html/bugzilla/template
When you open the browser again, Traditional Chinese will be displayed.
Finally, add a few crons, used by bugzilla:
crontab -e
5 0 * * * cd /home/httpd/bugzilla.domainname.com/web
&& ./collectstats.pl
55 0 * * * cd /home/httpd/bugzilla.domainname.com/web &&
./whineatnews.pl
*/15 * * * * cd /home/httpd/bugzilla.domainname.com/web &&
./whine.pl
�If installed, use the following method to install:
yum –disablerepo=epel install perl-DateTime
perl-DateTime-TimeZone perl-DBI perl-Template-Toolkit
perl-Template-Toolkit perl-Email-Send perl-Email-MIME perl-URI
perl-List-MoreUtils perl-DBD-Pg perl-DBD-Oracle
perl-GD perl-Chart perl-Template-GD perl-GDTextUtil
perl-GDGraph perl-MIME-tools perl-libwww-perl perl-XML-Twig
perl-PatchReader perl-LDAP perl-Authen-SASL perl-RadiusPerl
perl-SOAP-Lite JSON-RPC perl-JSON-XS perl-Test-Taint
perl-HTML-Parser perl-HTML-Scrubber
perl-Email-MIME-Attachment-Stripper perl-Email-Reply
perl-TheSchwartz perl-Daemon-Generic Math-Random-Secure
again with ./checksetup.pl
–check-modules check, found that there are still a few packages not installed, prompting to install with the following command, but I have been unable to install after executing:
/usr/bin/perl install-module.pl JSON::RPC
/usr/bin/perl install-module.pl Apache2::SizeLimit
/usr/bin/perl install-module.pl Math::Random::Secure
/usr/bin/perl install-module.pl Email::MIME
Then you don’t need bugzilla to install the module, install it yourself:
perl -MCPAN -e “install Email::MIME”
perl -MCPAN -e shell
cpan>force install JSON::RPC
cpan>force install Math::Random::Secure
Last check, it should be ok.
Edit the configuration file and fill in the directory, database ip, library name, user and password.
vim localconfig
Then you can officially install:
./checksetup.pl
You will be prompted to enter an email address and password, which is the default administrator user and password.
After installation, open the browser to see if it is normal.
In addition, the database needs to be optimized, add the following two lines:
[mysqld]
max_allowed_packet=4M
ft_min_word_len=2
Restart the database after making changes.
Install the Traditional Chinese package:
http://code.google.com/p/bugzilla-tw/
wget http://code.google.com/p/bugzilla-tw/downloads/detail?name=bugzilla.zh-TW.4.4r.20130609.tar.gz
tar -xvzf bugzilla.zh-TW.4.4r.20130609.tar.gz
cp -rf bugzilla-tw/template/zh-TW
/usr/local/nginx/html/bugzilla/template
When you open the browser again, Traditional Chinese will be displayed.
Finally, add a few crons, used by bugzilla:
crontab -e
5 0 * * * cd /home/httpd/bugzilla.domainname.com/web
&& ./collectstats.pl
55 0 * * * cd /home/httpd/bugzilla.domainname.com/web &&
./whineatnews.pl
*/15 * * * * cd /home/httpd/bugzilla.domainname.com/web &&
./whine.pl