协管网_神仙的blog
分页: 1/51 第一页 1 2 3 4 5 6 7 8 9 10 下页 最后页 [ 显示模式: 摘要 | 列表 ]

环境设置

1.            安装CENTOS 5.1

  这个就不用说了,但有一点要注意:为SWAP分配的空间要超过1G,要不然后面装Oralce会因为空间不足而无法安装。

2.            查询所需安装包是否完整

root用户在终端中执行以下命令:

rpm -q gcc make binutils openmotif setarch compat-db compat-gcc compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel

如果没有安装这些包的话,可以在CentOS安装光盘的CentOS目录下找到相应的rmp文件来安装,如果你的服务器可以联网的话,也可以通过yum的方式下载安装,我就是用yum安装的,在终端中执行以下命令:

yum install compat-gcc-32 compat-gcc-32-c++ compat-gcc-32-g77 compat-libf2c-32 compat-libstdc++-296 compat-libstdc++-33 compat-db compat-readline43

 

按命令提示的下载安装,所需的时间取决于你的网速,我用了大约一个小时的时间。

 

可能安装完了以后用上述命令查看还是会出现某些包没有安装的信息,这个不用理会,据说是rpmBUG

package compat-gcc-c++ is not installed

package compat-libstdc++ is not installed

package compat-libstdc++-devel is not installed

3.            OS参数要求

编辑 /etc/sysctl.conf  (vi或文本编辑器都可以), 在行末添加以下内容

#use for oracle

kernel.shmall = 2097152

kernel.shmmax = 2147483648

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

fs.file-max = 65536

net.ipv4.ip_local_port_range = 1024 65000

net.core.rmem_default=262144

net.core.rmem_max=262144

net.core.wmem_default=262144

net.core.wmem_max=262144


再运行sysctl -p应用以上参数


4.            编辑 /etc/security/limits.conf 行末添加以下内容

#use for oracle

* soft nproc 2047

* hard nproc 16384

* soft nofile 1024

* hard nofile 65536

5.            编辑 /etc/pam.d/login 行末添加以下内容

      session required pam_limits.so

6.            编辑 /etc/selinux/config 确保以下内容

  SELINUX=disabled

  关闭SELIINUX

7.            编辑 /etc/profile,在最后加入:

if [ $USER = "oracle" ]; then

         if [ $SHELL = "/bin/ksh" ]; then

                   ulimit -p 16384

                   ulimit -n 65536

         else

                   ulimit -u 16384 -n 65536

         fi

fi

8.            oracle安装文件复制到 /tmp/database目录下。

9.            因为默认centos5.1不支持10.2,0.1,修改安装文件

  编辑 /10201_database_linux32/database/install/oraparam.ini

### #[Certified Versions]

Linux=redhat-3,SuSE-9,redhat-4,centos-5,UnitedLinux-1.0,asianux-1,asianux-2

  再添加

   [Linux-centos-5.1-optional]

TEMP_SPACE=80

SWAP_SPACE=150

MIN_DISPLAY_COLORS=256

10.      修改目录权限


  #chmod -R 777 /tmp/database

 Oracle安装

1.            创建和配置用户

#/usr/sbin/groupadd oinstall

#/usr/sbin/groupadd dba

#/usr/sbin/useradd -m -g oinstall -G dba oracle

#id oracle

  Oracle用户设置密码:

  #passwd oracle

2.            创建安装目录

# mkdir -p /u01/app/oracle

# chown -R oracle:oinstall /u01/app/oracle

# chmod -R 775 /u01/app/oracle

3.            修改 Oracle 用户 .bash_profile

  # su - oracle

$ vi ./.bash_profile

   添加

   export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0.1

export ORACLE_SID=orcl

export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib

4.            开始安装

注销然后以oracle用户登录(如果你不重新登录而直接在终端中通过 “su – oracle” 切换到Oracle用户安装的话,可能会出现display设置错误的提示而无法安装)

打开一个终端,执行以下命令开始安装

  # cd /tmp /databases

# export LANG=en_US

# ./runInstaller

如果你的安装过程中还出现错误的话,应该是还有一些包没打上,这时你不必终止安装过程,而是打开另一个终端,以root用户身份再去查检安装最前面所说的那些包,如果这些包都装好了,再回到oracle安装程序,在出错提示框点击 “Retry” 即可继续安装,直到成功。

安装完后orcl数据库也已经启动。你可以在其它机器上配置netmanager测试一下是否能连接,如果其它机器没有装oracle客户端,也可以通过telnet命令测试一下1521端口是否可以连接(假如你安装了oracle的服务器的地址是192.168.1.1)

telnet 192.168.1.1 1521

如果进入黑屏,则基本上说明1521端口是通的,也就是说你的orale可以正常使用了。

如果不能连接,很可能是防火墙的问题。在服务器菜单中打开 “系统/管理/安全级别和防火墙”,然后添加1521端口。


5.            解决dbstart启动问题

安装完后重新启动系统,以root用户登录,打开一个终端,在终端中以oracle用户运行命令启动oracle数据库

# su - oracle

# dbstart

  提示打开 /ade/vikrkuma_new/oracle/bin/tnslsnr 失败

  编辑 /u01/app/oracle/product/10.2.0.1/bin/dbstart

  查找:

   # Set this to bring up Oracle Net Listener

ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle

  应该是在78行,将其改为:

# Set this to bring up Oracle Net Listener

ORACLE_HOME_LISTNER=$ORACLE_HOME

      

       但是重新运行dbstart时,没有提示出错,但立刻就执行完了,用lsnrctl status命令查看发现数据库实例还是没有启动。在分析dbstart脚本后发现还要读取 /etc/oratable配置文件,于是打开这个文件,将最后一行的最后一个字符由 “N” 改为 “Y”,如下:

       orcl: /u01/app/oracle/product/10.2.0.1:Y

保存退出,然后再执行dbstart,启动成功。

 

配置自动启动oracle的脚本

编辑etc/rc.d/rc.local

echo "Starting ORACLE 10g:"

su - oracle -c "//u01/app/oracle/product/10.2.0.1/bin/lsnrctl start"

su - oracle -c "/u01/app/oracle/product/10.2.0.1/bin/dbstart"

 

保存退出,下次重启centos的时候,oracle数据库也会自动启动。

 
+++++++++++++++++++++++++++++++++++++++++++
正文
+++++++++++++++++++++++++++++++++++++++++++


1、 mod_evasive 介绍;

mod_evasive 是Apache(httpd)服务器的防DDOS的一个模块。对于WEB服务器来说,是目前比较好的一个防护DDOS攻击的扩展模块。虽然并不能完全防御DDOS攻击,但在一定条件下,还是起到缓服Apache(httpd)服务器的压力。如果配合iptables、硬件防火墙等防火墙设备配合使用,可能有更好的效果。可惜LinuxSir.Org 并没有硬件防火墙,所以是否这种组合效果有更好的效果,我没办法验证。

mod_evasive 的官方地址: http://www.zdziarski.com/projects/mod_evasive/


2、 mod_evasive 的安装和配置;


2.1 mod_evasive 的下载地址;

mod_evasive_1.10.1.tar.gz


2.2 mod_evasive 的安装;

安装 mod_evasive 之前,你要用安装Apache(httpd)服务器软件包,还要安装httpd-devel或 apache-dev。在Slackware 12.0中,安装httpd软件即可;

对于Apache 1.x 请用下面的编译方法;

#/usr/sbin/apxs -iac mod_evasive.c

对于Apache 2.x 可以用下面的办法;

#tar zxvf mod_evasive_1.10.1.tar.gz
#cd mod_evasive
#/usr/sbin/apxs -i -a -c mod_evasive20.c

注:apxs 用于编译模块工具;如果是用系统自带的软件包,一般位于/usr/sbin目录。如果您是自己编译安装Apache(httpd)的,你应该自己来指定路径;

我们然后修改/etc/ld.so.conf 文件,把编译出来的动态模块的所在位置指定在 ld.so.conf中;比如我用的是Aapche 2.x ,编译完成后,模块mod_evasive20.so 安装到了 /usr/lib/httpd/modules 目录中;那我们就要把 这个目录写入到ld.so.conf中。

#echo "/usr/lib/httpd/modules" >> /etc/ld.so.conf
#ldconfig

注: 具体要与你的系统环境为准,不要照搬照抄,如果你对Linux不太熟的话;


2.3 mod_evasive 的配置;

在编译安装完成后,会自动插入一行到Apache 配置文件中,对于Apache 2.x 版本中,应该在其配置文件中有类似下面的一行;

LoadModule evasive20_module   lib/httpd/modules/mod_evasive20.so

对于Apache 1.x来说,也应该差不多,大体只是路径不同罢了;

然后我们再修改 Apache 的配置文件,配置文件名为httpd.conf;

在Apache v1.x 版本中,要加入;

<IfModule mod_evasive.c>
    DOSHashTableSize    3097
    DOSPageCount        2
    DOSSiteCount        50
    DOSPageInterval     1
    DOSSiteInterval     1
    DOSBlockingPeriod   10
</IfModule>

在Apache v2.x加入;

<IfModule mod_evasive20.c>
    DOSHashTableSize    3097
    DOSPageCount        2
    DOSSiteCount        50
    DOSPageInterval     1
    DOSSiteInterval     1
    DOSBlockingPeriod   10
</IfModule>

如果您不知道把这些插入到哪,用下面的办法做也是可以的;

在/etc目录中创建一个文件,比如mod_evasive.conf;

#touch /etc/mod_evasive.conf

然后把根据自己的Apache版本来加入相应的内容;

接着我们再修改 httpd.conf ,在最后一行加入

Include /etc/mod_evasive.conf

修改完成后,我们要重启Apache服务器;

比如在Slackware 12.0中,Apache 2.x的重启,我们要用到

#/etc/rc.d/rc.httpd restart

在Redhat、Fededora、Debian、Ubuntu、CentOS中的Apache,可以用;

#/etc/init.d/httpd restart

#/etc/init.d/apache restart

大体上差不多是这样的……


2.4 对mod_evasive测试验证 ;

防DDOS的模块做好后,我们可以要验证,可以用Apache 自带的ab工具,系统默认安装在/usr/sbin目录中;比如;

#/usr/sbin/ab -n 1000 -c 50 http://www.google.com:80/

注:上面的例子的意思是,如果您的服务器是google的WEB服务器,我们要发送数据请求包,总共1000个,每次并发50个;

另外一个测试工具就是mod_evasive的解压包的目录中,有个test.pl ,你可以修改IP地址,然后用

#perl test.pl

是不是有效果,请根据 ab工具或 测试脚本出来的结果来查看;

因为我们编译mod_evasive时,用的是默认配置,所以日志被存放在/tmp目录中。如果有DDOS攻击,会在/tmp产生日志。日志的文件是以 dos-开头的;


3、mod_evasive 的高级配置;

如果想更改一些适合自己的参数,有些必要的参数,并不是通过配置文件修改就一下起作用的,我们要修改源码包中的 mod_evasive.c(Apache 1.x用之) 或 mod_evasive20.c (Apache 2.x用之);

#define DEFAULT_HASH_TBL_SIZE   3097ul  // Default hash table size
#define DEFAULT_PAGE_COUNT      2       // Default maximum page hit count per interval
#define DEFAULT_SITE_COUNT      50      // Default maximum site hit count per interval
#define DEFAULT_PAGE_INTERVAL   1       // Default 1 Second page interval
#define DEFAULT_SITE_INTERVAL   1       // Default 1 Second site interval
#define DEFAULT_BLOCKING_PERIOD 10      // Default for Detected IPs; blocked for 10 seconds
#define DEFAULT_LOG_DIR         "/tmp"  // Default temp directory

比如我们改改其中的数字,根据英文很容易理解。比如修改日志存放目录,就把/tmp改成别的目录。如果您不知道放在哪好,还是用默认的吧;

如果您在这里更改了参数,不要忘记修改Apache 配置文件中关于mod_evasive 的参数;

如果您想加入一些其它的参数,请查阅源码包中的README,里面有详细说明,大多来说没太大的必要……

这个文件相当重要,如果您想更改某些设置,就要修改这个文件…… 


4、关于本文;

mod_evasive 还是有点用的,安装也不费力气。如果你需要的时候,会想到这个模块的 …… mod_evasive 是否有更高级的用法,也不是在这篇文章里能说的清楚的。如果不懂怎么办?请查看源码包中的README。

本文权当做软件说明 ……

北南 记之

From LinuxSir.Org


5、参考文档;

参考 mod_evasive 源码包中的README ……

其实原来使用apache配置虚拟主机一直都是用vhost文件,或者httpd.conf里面虚拟站点的配置事例来做!


后来渐渐了解了mod_rewrite模块,直到apache支持url重写可以让每个液面都有一个独立的静态url,能支持baidu和google更好的收录!

客户要求的也越来越多!
所以才准备把经验写出来!

[不指定 2008/10/31 16:55 | by tinkoko ]

默认的只有100

vi /usr/local/mysql/bin/mysqld_safe

找到safe_mysqld编辑它,找到mysqld启动的那两行,在后面加上参数:

-O max_connections=1500

具体一点就是下面的位置:

用红字特别说明:

then $NOHUP_NICENESS $ledir/$MYSQLD

$defaults --basedir=$MY_BASEDIR_VERSION

--datadir=$DATADIR $USER_OPTION

--pid-file=$pid_file

--skip-external-locking

-O max_connections=1500

>> $err_log 2>&1 else

eval "$NOHUP_NICENESS $ledir/$MYSQLD

$defaults --basedir=$MY_BASEDIR_VERSION

--datadir=$DATADIR $USER_OPTION

--pid-file=$pid_file

--skip-external-locking $args

-O max_connections=1500 >>

$err_log 2>&1"

保存。

# service mysqld restart

# /usr/local/mysql/bin/mysqladmin -uroot -p variables

输入root数据库账号的密码后可看到

max_connections 1500 即新改动已经生效。

一直听说nginx对于fcgi支持是多么的好,俄罗斯轻量级web服务器nginx支持的并发连接时apache的10倍

多。但是占用物理内存不到150M,今天终于可以研究下了!
lighttpd如果加在其中也使作为配置php-cgi程序!
下面摘自官网评价
==============================================================
Nginx ("engine x") 是一个高性能的 HTTP 和反向代理服务器,也是一个 IMAP/POP3/SMTP 代理服务器

。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,它已经在该站点运行超过

两年半了。Igor 将源代码以类BSD许可证的形式发布。
Nginx 是一个很牛的高性能 Web 和反向代理服务器, 它具有有很多非常优越的特性:

在高连接并发的情况下,Nginx 是 Apache 服务器不错的替代品:Nginx 在美国是做虚拟主机生意

的老板们经常选择的软件平台之一。能够支持高达 50,000 个并发连接数的响应。

Nginx 作为负载均衡服务器:Nginx 既可以在内部直接支持 Rails 和 PHP 程序对外进行服务, 也

可以支持作为 HTTP 代理服务器对外进行服务。Nginx 采用 C 进行编写,不论是系统资源开销还是 CPU

使用效率都比 Perlbal 要好很多。

作为邮件代理服务器:Nginx 同时也是一个非常优秀的邮件代理服务器(最早开发这个产品的目的

之一也是作为邮件代理服务器),Last.fm 描述了成功并且美妙的使用经验。

Nginx 是一个 安装非常的简单,配置文件 非常简洁(还能够支持 perl 语法),Bugs 非常少的

服务器:Nginx 启动特别容易,并且几乎可以做到 7*24 不间断运行,即使运行数个月也不需要重新启动

。还能够不间断服务的情况下进行软件版本的升级。
==============================================================================
我们开始下载所需要的软件
Nginx的中文wiki:http://wiki.codemongers.com/NginxChs

wget http://sysoev.ru/nginx/nginx-0.6.32.tar.gz
wget http://www.php.net/get/php-5.2.6.tar.gz/from/this/mirror
wget http://php-fpm.anight.org/downloads/head/php-5.2.6-fpm-0.5.8.diff.gz
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.7.tar.gz
wget http://xcache.lighttpd.net/pub/Releases/1.2.2/xcache-1.2.2.tar.gz

Mysql自己下载,地址我这便记录丢掉了!目前来说Php-fpm只有5.2.6的补丁!php-fpm是为PHP打的一个

FastCGI管理补丁,可以平滑变更php.ini配置而无需重启php-cgi
php-fpm官网:http://php-fpm.anight.org/index.html


另外服务器上安装以下软件包
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype

freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel

glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel
默认都会安装~~

==========================================================

第一步:安装Mysql,不论是源代码还是二进制只要能运行就好了

cp mysql-5.0.22.tar.gz /usr/local/src
cd /usr/local/src
tar zxvf mysql-5.0.22.tar.gz
cd mysql-5.0.22
./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/var/lib/mysql --

with-charset=gbk --with-xcharset=all

make && make install

usr/local/mysql/bin/mysql_install_db

groupadd -g 20000 mysql
useradd -u 20000 root -g mysql mysql
chown -R mysql /var/lib/mysql

cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf

/usr/local/mysql/bin/mysql/mysqld_safe --user=root &

/usr/local/mysql/bin/mysqladmin -u root -p password 6xuan


enter password:回车


/usr/local/mysql/bin/mysql -u root -p

输入密码:6xuan

进入mysql
成功了~~~~~~~~~~~~~~~~~~~~~~~~~


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
第二步:安装php和php-fpm
tar zxvf php-5.2.6.tar.gz
gzip -cd php-5.2.6-fpm-0.5.8.diff.gz | patch -d php-5.2.6 -p1
cd php-5.2.6/
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql/ --with-gd=/usr --with-gd-lib=/usr/lib --with-jpeg dir=/usr --with-png-dir=/usr/include/ --with-zlib --enable-mbstring --enable-iconv --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --with-openssl

make && make install

cp php.ini-dist /usr/local/lib/php/php.ini


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

第三步,配置xcache和memcache,让php加速

tar zxvf memcache-2.2.3.tgz
cd memcache-2.2.3/
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
cd ../


tar zxvf xcache-1.2.2.tar.gz
cd xcache-1.2.2
[root@localhost xcache-1.2.2]# /usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --enable-xcache
make
make install
cd ../

执行
sed -i 's#extension_dir = "./"#extension_dir = "/usr/local/php/lib/php/extensions/no-debug-

non-zts-20060613/"\nextension = "memcache.so"\n#' /usr/local/lib/php/php.ini
sed -i 's#display_errors = On#display_errors = Off#' /usr/local/lib/php/php.ini
它将会自动修改php.ini

然后继续配置php.ini,让他增加xcache加速

vi /usr/local/lib/php/php.ini

在最后面加入

[xcache-common]
zend_extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/xcache.so

[xcache.admin]
xcache.admin.user = "xcache"
; xcache.admin.pass = md5($yourpasswd)
xcache.admin.pass = "8e6867a5d05144cf4761d6481fc674a8"

[xcache]
xcache.cacher = On
xcache.shm_scheme = "mmap"
xcache.size = 32M
; cpu number (cat /proc/cpuinfo |grep -c processor)
xcache.count = 2
xcache.slots = 8k
xcache.ttl = 0
xcache.gc_interval = 0
xcache.var_size = 2M
; cpu number (cat /proc/cpuinfo |grep -c processor)
xcache.var_count = 2
xcache.var_slots = 8K
xcache.var_ttl = 0
xcache.var_maxttl = 0
xcache.var_gc_interval = 300
xcache.readonly_protection = Off
xcache.mmap_path = "/dev/zero"

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

第四步:配置php-fpm.conf
创建php-fpm启动的用户和组
[root@localhost php]# /usr/sbin/groupadd www -g 480
[root@localhost php]# /usr/sbin/useradd -u 480 -g www www


vi /usr/local/php/etc/php-fpm.conf
用下面的代替里面内容

===============================================================================
<?xml version="1.0" ?>
<configuration>

All relative paths in this config are relative to php's install prefix

<section name="global_options">

Pid file
<value name="pid_file">/usr/local/php/logs/php-fpm.pid</value>

Error log file
<value name="error_log">/usr/local/php/logs/php-fpm.log</value>

Log level
<value name="log_level">notice</value>

When this amount of php processes exited with SIGSEGV or SIGBUS ...
<value name="emergency_restart_threshold">10</value>

... in a less than this interval of time, a graceful restart will be initiated.
Useful to work around accidental curruptions in accelerator's shared memory.
<value name="emergency_restart_interval">1m</value>

Time limit on waiting child's reaction on signals from master
<value name="process_control_timeout">5s</value>

Set to 'no' to debug fpm
<value name="daemonize">yes</value>

</section>

<workers>

<section name="pool">

Name of pool. Used in logs and stats.
<value name="name">default</value>

Address to accept fastcgi requests on.
Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'
<value name="listen_address">127.0.0.1:9000</value>

<value name="listen_options">
Set listen(2) backlog
<value name="backlog">-1</value>

Set permissions for unix socket, if one used.
In Linux read/write permissions must be set in order to allow connections from web server.
Many BSD-derrived systems allow connections regardless of permissions.
<value name="owner"></value>
<value name="group"></value>
<value name="mode">0666</value>
</value>

Additional php.ini defines, specific to this pool of workers.
<value name="php_defines">
<value name="sendmail_path">/usr/sbin/sendmail -t -i</value>
<value name="display_errors">1</value>
</value>

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

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

Process manager settings
<value name="pm">

Sets style of controling worker process count.
Valid values are 'static' and 'apache-like'
<value name="style">static</value>

Sets the limit on the number of simultaneous requests that will be served.
Equivalent to Apache MaxClients directive.
Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
Used with any pm_style.
<value name="max_children">128</value>

Settings group for 'apache-like' pm style
<value name="apache_like">

Sets the number of server processes created on startup.
Used only when 'apache-like' pm_style is selected
<value name="StartServers">20</value>

Sets the desired minimum number of idle server processes.
Used only when 'apache-like' pm_style is selected
<value name="MinSpareServers">5</value>

Sets the desired maximum number of idle server processes.
Used only when 'apache-like' pm_style is selected
<value name="MaxSpareServers">35</value>

</value>

</value>

The timeout (in seconds) for serving a single request after which the worker process will be terminated
Should be used when 'max_execution_time' ini option does not stop script execution for some reason
'0s' means 'off'
<value name="request_terminate_timeout">0s</value>

The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file
'0s' means 'off'
<value name="request_slowlog_timeout">0s</value>

The log file for slow requests
<value name="slowlog">logs/slow.log</value>

Set open file desc rlimit
<value name="rlimit_files">51200</value>

Set max core size rlimit
<value name="rlimit_core">0</value>

Chroot to this directory at the start, absolute path
<value name="chroot"></value>

Chdir to this directory at the start, absolute path
<value name="chdir"></value>

Redirect workers' stdout and stderr into main error log.
If not set, they will be redirected to /dev/null, according to FastCGI specs
<value name="catch_workers_output">yes</value>

How much requests each process should execute before respawn.
Useful to work around memory leaks in 3rd party libraries.
For endless request processing please specify 0
Equivalent to PHP_FCGI_MAX_REQUESTS
<value name="max_requests">10240</value>

Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect.
Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2+)
Makes sense only with AF_INET listening socket.
<value name="allowed_clients">127.0.0.1</value>

Pass environment variables like LD_LIBRARY_PATH
All $VARIABLEs are taken from current environment
<value name="environment">
<value name="HOSTNAME">$HOSTNAME</value>
<value name="PATH">/usr/local/bin:/usr/bin:/bin</value>
<value name="TMP">/tmp</value>
<value name="TMPDIR">/tmp</value>
<value name="TEMP">/tmp</value>
<value name="OSTYPE">$OSTYPE</value>
<value name="MACHTYPE">$MACHTYPE</value>
<value name="MALLOC_CHECK_">2</value>
</value>

</section>

</workers>

</configuration>

==============================================================================
启动php-fpm进程
/usr/local/php/sbin/php-fpm start

你可以用 ps -aux| grep php-cgi
查看是否存在进程


netstat -ant看是否在9000端口侦听


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
第5步,安装pcre
tar zxvf pcre-7.7.tar.gz
cd pcre-7.7/
./configure
make && make install

~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
第六步,安装配置nginx

./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module

--with-http_ssl_module
make && make install

修改/usr/local/nginx/conf/nginx.conf

用下面内容替换

==========================================

user  www www;

worker_processes 8;

error_log  /var/log/nginx/nginx_error.log  crit;

pid        /var/run/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;

events
{
 use epoll;
 worker_connections 51200;
}

http
{
 include       mime.types;
 default_type  application/octet-stream;

     
 server_names_hash_bucket_size 128;
 client_header_buffer_size 32k;
 large_client_header_buffers 4 32k;
     
 sendfile on;
 tcp_nopush     on;

 keepalive_timeout 60;

 tcp_nodelay on;

 fastcgi_connect_timeout 300;
 fastcgi_send_timeout 300;
 fastcgi_read_timeout 300;
 fastcgi_buffer_size 64k;
 fastcgi_buffers 4 64k;
 fastcgi_busy_buffers_size 128k;
 fastcgi_temp_file_write_size 128k;

 gzip on;
 gzip_min_length  1k;
 gzip_buffers     4 16k;
 gzip_http_version 1.0;
 gzip_comp_level 2;
 gzip_types       text/plain application/x-javascript text/css application/xml;
 gzip_vary on;

 #limit_zone  crawler  $binary_remote_addr  10m;

 server
 {
   listen       80;
   server_name  localhost;
   index index.html index.htm index.php;
   root  /usr/local/nginx/html;

   #limit_conn   crawler  20;    
                           
   location ~ .*\.(php|php5)?$
   {      
     #fastcgi_pass  unix:/tmp/php-cgi.sock;
     fastcgi_pass  127.0.0.1:9000;
     fastcgi_index index.php;
     include fcgi.conf;
   }
   
   location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
   {
     expires      30d;
   }

   location ~ .*\.(js|css)?$
   {
     expires      1h;
   }    

   log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';
   access_log  /var/log/nginx/access.log  access;
     }


===========================================================
里面的

error_log /var/log/nginx/nginx_error.log crit;

pid /var/run/nginx.pid;
请根绝自己的修改
运行以下命令检测配置文件是否无误:

# /usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

创建fcgi的配置文件
vi /usr/local/nginx/conf/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;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;




然后启动nginx
启动Nginx
/usr/local/nginx/sbin/nginx

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

关于测试

在/usr/local/nginx/html里面创建phpinfo探针~~

分页: 1/51 第一页 1 2 3 4 5 6 7 8 9 10 下页 最后页 [ 显示模式: 摘要 | 列表 ]