免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2323 | 回复: 0
打印 上一主题 下一主题

Nginx在FreeBsd下的安装与配置 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-10-12 15:45 |只看该作者 |倒序浏览

                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
/usr/local/nginx/sbin/nginx 效果如下:

               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/30125/showart_399397.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP