第 16 章 nginx

简介:
pkg_add -r nginx

location / {
        root   /usr/local/www/nginx;
        index  index.html index.htm;
}

location ~ \.php$ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /usr/local/www/nginx$fastcgi_script_name;
        include        fastcgi_params;
}
	

16.1. port install

# cd /usr/ports/www/nginx

# make install

HTTP_MODULE
HTTP_REWRITE_MODULE
HTTP_STATUS_MODULE
		

16.1.1. php

ports 安装 php-fpm 适合 php-5.2.10, 高于这个版本请跳过这节, 采用编译安装。

# cd /usr/ports/lang/php5
# make install
			

extensions

# cd /usr/ports/lang/php5-extensions/
# make install
# ln -s /usr/local/etc/php.ini-production /usr/local/etc/php.ini
			

php-fpm - FastCGI Process Manager

homepage: http://php-fpm.org/downloads/freebsd-port/

			
# tar xvzf php-5.2.10-fpm-0.5.13.tar.gz --directory=/usr/ports/lang
x php5-fpm/
x php5-fpm/files/
x php5-fpm/Makefile
x php5-fpm/distinfo
x php5-fpm/pkg-descr
x php5-fpm/pkg-plist
x php5-fpm/files/php-fpm.sh.in
x php5-fpm/files/patch-scripts::phpize.in
x php5-fpm/files/patch-TSRM_threads.m4
x php5-fpm/files/patch-Zend::zend.h
x php5-fpm/files/patch-Zend_zend_list.c
x php5-fpm/files/patch-Zend_zend_list.h
x php5-fpm/files/patch-ext_standard_array.c
x php5-fpm/files/patch-ext_standard_basic_functions.c
x php5-fpm/files/patch-ext_standard_dns.h
x php5-fpm/files/patch-ext_standard_image.c
x php5-fpm/files/patch-php.ini-dist
x php5-fpm/files/patch-php.ini-recommended
x php5-fpm/files/patch-main::php_config.h.in
x php5-fpm/files/patch-main_SAPI.c
x php5-fpm/files/patch-acinclude.m4
x php5-fpm/files/patch-configure.in

# cd /usr/ports/lang/php5-fpm/ && make install
			
			

16.1.1.1. php-fpm

				
                        Unix user of processes
                        <value name="user">www</value>

                        Unix group of processes
                        <value name="group">www</value>
				
				

16.1.2. /etc/rc.conf

vim /etc/rc.conf
php_fpm_enable="YES"
nginx_enable="YES"
			

16.1.3. /usr/local/etc/nginx/nginx.conf

ee /usr/local/etc/nginx/nginx.conf

        location / {
            root   /www;
            index  index.html index.htm index.php;
        }

        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /www$fastcgi_script_name;
            include        fastcgi_params;
        }

			

16.1.4. start

/usr/local/etc/rc.d/php-fpm start
/usr/local/etc/rc.d/nginx start
			




原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

目录
相关文章
|
9月前
|
负载均衡 前端开发 安全
nginx能帮我们做什么?
Nginx是一款高性能的开源Web服务器软件,它可以帮助我们完成以下几个方面的任务:
67 0
|
5月前
|
缓存 应用服务中间件 nginx
Nginx使用总结
Nginx使用总结
59 0
|
7月前
|
应用服务中间件 nginx
nginx
nginx
31 0
|
8月前
|
负载均衡 应用服务中间件 nginx
|
应用服务中间件 网络安全 nginx
nginx应用
nginx应用
98 0
|
缓存 负载均衡 算法
Nginx——详解
Nginx是lgor Sysoev为俄罗斯访问量第二的rambler.ru站点设计开发的。从2004年发布至今,凭借开源的力量,已经接近成熟与完善。
122 0
Nginx——详解
|
应用服务中间件 Apache 开发工具
关于Nginx,你需要知道的!
关于Nginx,你需要知道的!
166 0
|
存储 缓存 安全
Nginx基本应用(一)
Nginx基本应用(一)
Nginx基本应用(一)
|
XML 缓存 应用服务中间件
|
应用服务中间件 nginx
Nginx的使用
Nginx的使用
86 0
Nginx的使用