Nginx在FreeBsd下的安装与配置

2009-05-13 10:18:34来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折


                What for? Nginx is a great replacement of Apache with very low memory
footprint and contrary to Lighttpd, doesn't suffer from memory leak
over time. You can then use all the memory left to unleash the power of
mysql for instance by increasing the default query cache.
真的有传说中的好吗?呵呵,试一下先。
Step1 安装必备软件
    MySQL+PHP+Pcre
cd /usr/ports/database/mysql50-server && make install clean
cd /usr/lang/php5/ && make install clean
cd /usr/devel/pcre && make install clean
Step2 安装FastCgi(借用lighttpd的spawn-cgi)
wget http://www.lighttpd.net/download/lighttpd-1.4.18.tar.bz2
tar -xvjf lighttpd-1.4.18.tar.bz2 cd lighttpd-1.4.18
cd lighttpd-1.4.18
./configure
make
cp src/spawn-fcgi /usr/bin/spawn-fcgi
vi /usr/bin/php-fastcgi
#!/bin/sh
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www -f /usr/local/bin/php-cgi
chmod 755 /usr/bin/php-fastcgi
vi /etc/rc.d/init-fastcgi
#!/bin/bash
PHP_SCRIPT=/usr/bin/php-fastcgi
RETVAL=0
case "$1"
in
    start)
      $PHP_SCRIPT
      RETVAL=$?
  ;;
    stop)
      killall
-9
php
      RETVAL=$?
  ;;
    restart)
      killall
-9
php
      $PHP_SCRIPT
      RETVAL=$?
  ;;
    *)
      echo
"Usage: php-fastcgi
{start|stop|restart}"
      exit 1
  ;;
esac
exit $RETVAL
chmod 755 /etc/rc.d/init-fastcgi
Step3 安装Nginx(本文用目前稳定版)
wget http://sysoev.ru/nginx/nginx-0.5.32.tar.gz
tar xvzf nginx-0.5.32.tar.gz
cd nginx-0.5.32
./configure (默认安装在/usr/local/nginx)
make && make install
Step4 配置Nginx (主要修改)
cp conf/fastcgi_params /usr/local/nginx/conf/fastcgi_params location / {
        root /var/www/wordpress; (此处就是你的web根目录)
            index  index.php index.html index.htm;
        }
location ~ .*\.php$ {
            fastcgi_pass
127.0.0.1:9000;
            fastcgi_index
index.php;
            fastcgi_param
SCRIPT_FILENAME /var/www/wordpress$fastcgi_script_name;
            include
/usr/local/nginx/conf/fastcgi_params;
        }
Step5 启动了,呵呵
/etc/rc.d/init-fastcgi start

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:OpenLDAP调试

下一篇:Mail 调试