硬件环境:
Dell PowerEdge 1950,4核Intel(R) Xeon(R) CPU E5410  @ 2.33GHz
4G内存

系统环境:CentOS release 5.2,内核版本: 2.6.18-92.el5

安装步骤:
一、编译安装php 5.4.3所需的支持库
1.下载以下rpm包到/usr/local/software
curl-devel-7.15.5-2.el5.i386.rpm        krb5-devel-1.6.1-25.el5.i386.rpm             libpng-devel-1.2.10-7.1.el5_0.1.i386.rpm  MySQL-client-5.5.24-1.linux2.6.i386.rpm
cyrus-sasl-devel-2.1.22-4.i386.rpm      libidn-devel-0.6.5-1.1.i386.rpm              libselinux-devel-1.33.4-5.el5.i386.rpm    MySQL-server-5.5.24-1.linux2.6.i386.rpm
e2fsprogs-devel-1.39-15.el5.i386.rpm    libjpeg-devel-6b-37.i386.rpm                 libsepol-devel-1.15.2-1.el5.i386.rpm      openldap-devel-2.3.27-8.el5_1.3.i386.rpm
freetype-devel-2.2.1-19.el5.i386.rpm    libmcrypt-2.5.8-4.el5.centos.i386.rpm        libxml2-devel-2.6.26-2.1.2.i386.rpm       openssl-devel-0.9.8b-10.el5.i386.rpm
keyutils-libs-devel-1.2-1.el5.i386.rpm  libmcrypt-devel-2.5.8-4.el5.centos.i386.rpm  libxslt-devel-1.1.17-2.i386.rpm           zlib-devel-1.2.3-3.i386.rpm

2.安装rpm包
[root@omc-0 software]# rpm -ivh *.rpm

3.修改MySQL数据库密码
[root@omc-0 software]# /usr/bin/mysqladmin -u root password 'new-password'

4.下载安装libiconv-1.14.tar.gz
[root@omc-0 software]# tar zxvf libiconv-1.14.tar.gz
[root@omc-0 software]# cd libiconv-1.14
[root@omc-0 software]# ./configure
[root@omc-0 software]# make
[root@omc-0 software]# make install

5.修改/etc/ld.so.conf,使php编译的时候能找到/usr/local/lib下面的库文件。在这儿是使php编译能找到/usr/local/lib/libiconv.so.2.5.1
a.在/etc/ld.so.conf中加一行/usr/local/lib
b.然后运行/sbin/ldconfig

6.编译安装php5.4.3
[root@omc-0 software]# tar zxvf php-5.4.3.tar.gz
[root@omc-0 software]# cd php-5.4.3
[root@omc-0 software]#./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc --with-mysql --with-mysqli --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --with-pear   --enable-pdo --with-pdo-mysql --with-gettext --enable-exif --enable-wddx --enable-calendar --enable-ftp  --enable-dba --enable-sysvmsg  --enable-sysvshm --enable-debug --enable-maintainer-zts --enable-embed --with-pcre-regex --enable-gd-jis-conv

[root@omc-0 software]# make ZEND_EXTRA_LIBS='-liconv'
[root@omc-0 software]# make install
Installing PHP SAPI module:       embed
Installing PHP CLI binary:        /usr/local/webserver/php/bin/
Installing PHP CLI man page:      /usr/local/webserver/php/php/man/man1/
Installing PHP FPM binary:        /usr/local/webserver/php/sbin/
Installing PHP FPM config:        /usr/local/webserver/php/etc/
Installing PHP FPM man page:      /usr/local/webserver/php/php/man/man8/
Installing PHP FPM status page:      /usr/local/webserver/php/php/fpm/
Installing PHP CGI binary:        /usr/local/webserver/php/bin/
Installing build environment:     /usr/local/webserver/php/lib/php/build/
Installing header files:          /usr/local/webserver/php/include/php/
Installing helper programs:       /usr/local/webserver/php/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/webserver/php/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/webserver/php/lib/php/
[PEAR] Archive_Tar    - installed: 1.3.7
[PEAR] Console_Getopt - installed: 1.3.0
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util       - installed: 1.2.1
[PEAR] PEAR           - installed: 1.9.4
Wrote PEAR system config file at: /usr/local/webserver/php/etc/pear.conf
You may want to add: /usr/local/webserver/php/lib/php to your php.ini include_path
/usr/local/software/php-5.4.3/build/shtool install -c ext/phar/phar.phar /usr/local/webserver/php/bin
ln -s -f /usr/local/webserver/php/bin/phar.phar /usr/local/webserver/php/bin/phar
Installing PDO headers:          /usr/local/webserver/php/include/php/ext/pdo/

[root@omc-0 software]# cp php.ini-production /usr/local/webserver/php/etc/php.ini
[root@omc-0 software]# cp /usr/local/webserver/php/etc/php-fpm.conf.default /usr/local/webserver/php/etc/php-fpm.conf

7.配置php

修改环境变量,让php可执行文件能像linux命令一样
vim /etc/profile
在最低端加上
PATH=/usr/local/webserver/php/bin:$PATH
PATH=/usr/local/webserver/php/sbin:$PATH

8.设置php-fpm开机启动
[root@omc-0 php-5.4.3]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@omc-0 php-5.4.3]# chmod 755 /etc/init.d/php-fpm
[root@omc-0 php-5.4.3]# chkconfig --add php-fpm

二、安装Niginx
1.下载nginx-stable-1.2.0-1.el5.i386.rpm

2.root@omc-0 software]# rpm -ivh nginx-stable-1.2.0-1.el5.i386.rpm
3.设置Nginx开机启动
[root@omc-0 php-5.4.3]# chkconfig --add nginx

三、修改php-fpm.conf and nginx.conf

[root@omc-0 html]# vim /usr/local/webserver/php/etc/php-fpm.conf
(下面红色的部分代表为修改的部分)

  1. ;;;;;;;;;;;;;;;;;;;;;
  2. ; FPM Configuration ;
  3. ;;;;;;;;;;;;;;;;;;;;;
  4. ; All relative paths in this configuration file are relative to PHP's install
  5. ; prefix (/usr/local/webserver/php). This prefix can be dynamicaly changed by using the
  6. ; '-p' argument from the command line.
  7. ; Include one or more files. If glob(3) exists, it is used to include a bunch of
  8. ; files from a glob(3) pattern. This directive can be used everywhere in the
  9. ; file.
  10. ; Relative path can also be used. They will be prefixed by:
  11. ; - the global prefix if it's been set (-p arguement)
  12. ; - /usr/local/webserver/php otherwise
  13. ;include=etc/fpm.d/*.conf
  14. ;;;;;;;;;;;;;;;;;;
  15. ; Global Options ;
  16. ;;;;;;;;;;;;;;;;;;
  17. [global]
  18. ; Pid file
  19. ; Note: the default prefix is /usr/local/webserver/php/var
  20. ; Default Value: none
  21. pid = run/php-fpm.pid
  22. ; Error log file
  23. ; If it's set to "syslog", log is sent to syslogd instead of being written
  24. ; in a local file.
  25. ; Note: the default prefix is /usr/local/webserver/php/var
  26. ; Default Value: log/php-fpm.log
  27. ;error_log = log/php-fpm.log
  28. ; syslog_facility is used to specify what type of program is logging the
  29. ; message. This lets syslogd specify that messages from different facilities
  30. ; will be handled differently.
  31. ; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON)
  32. ; Default Value: daemon
  33. ;syslog.facility = daemon
  34. ; syslog_ident is prepended to every message. If you have multiple FPM
  35. ; instances running on the same server, you can change the default value
  36. ; which must suit common needs.
  37. ; Default Value: php-fpm
  38. ;syslog.ident = php-fpm
  39. ; Log level
  40. ; Possible Values: alert, error, warning, notice, debug
  41. ; Default Value: notice
  42. ;log_level = notice
  43. ; If this number of child processes exit with SIGSEGV or SIGBUS within the time
  44. ; interval set by emergency_restart_interval then FPM will restart. A value
  45. ; of '0' means 'Off'.
  46. ; Default Value: 0
  47. ;emergency_restart_threshold = 0
  48. ; Interval of time used by emergency_restart_interval to determine when
  49. ; a graceful restart will be initiated. This can be useful to work around
  50. ; accidental corruptions in an accelerator's shared memory.
  51. ; Available Units: s(econds), m(inutes), h(ours), or d(ays)
  52. ; Default Unit: seconds
  53. ; Default Value: 0
  54. ;emergency_restart_interval = 0
  55. ; Time limit for child processes to wait for a reaction on signals from master.
  56. ; Available units: s(econds), m(inutes), h(ours), or d(ays)
  57. ; Default Unit: seconds
  58. ; Default Value: 0
  59. ;process_control_timeout = 0
  60. ; The maximum number of processes FPM will fork. This has been design to control
  61. ; the global number of processes when using dynamic PM within a lot of pools.
  62. ; Use it with caution.
  63. ; Note: A value of 0 indicates no limit
  64. ; Default Value: 0
  65. ; process.max = 128
  66. ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
  67. ; Default Value: yes
  68. ;daemonize = yes
  69. ; Set open file descriptor rlimit for the master process.
  70. ; Default Value: system defined value
  71. ;rlimit_files = 1024
  72. ; Set max core size rlimit for the master process.
  73. ; Possible Values: 'unlimited' or an integer greater or equal to 0
  74. ; Default Value: system defined value
  75. ;rlimit_core = 0
  76. ; Specify the event mechanism FPM will use. The following is available:
  77. ; - select (any POSIX os)
  78. ; - poll (any POSIX os)
  79. ; - epoll (linux >= 2.5.44)
  80. ; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0)
  81. ; - /dev/poll (Solaris >= 7)
  82. ; - port (Solaris >= 10)
  83. ; Default Value: not set (auto detection)
  84. ; events.mechanism = epoll
  85. ;;;;;;;;;;;;;;;;;;;;
  86. ; Pool Definitions ;
  87. ;;;;;;;;;;;;;;;;;;;;
  88. ; Multiple pools of child processes may be started with different listening
  89. ; ports and different management options. The name of the pool will be
  90. ; used in logs and stats. There is no limitation on the number of pools which
  91. ; FPM can handle. Your system will tell you anyway :)
  92. ; Start a new pool named 'www'.
  93. ; the variable $pool can we used in any directive and will be replaced by the
  94. ; pool name ('www' here)
  95. [www]
  96. ; Per pool prefix
  97. ; It only applies on the following directives:
  98. ; - 'slowlog'
  99. ; - 'listen' (unixsocket)
  100. ; - 'chroot'
  101. ; - 'chdir'
  102. ; - 'php_values'
  103. ; - 'php_admin_values'
  104. ; When not set, the global prefix (or /usr/local/webserver/php) applies instead.
  105. ; Note: This directive can also be relative to the global prefix.
  106. ; Default Value: none
  107. ;prefix = /path/to/pools/$pool
  108. ; Unix user/group of processes
  109. ; Note: The user is mandatory. If the group is not set, the default user's group
  110. ; will be used.
  111. user = nobody
  112. group = nobody
  113. ; The address on which to accept FastCGI requests.
  114. ; Valid syntaxes are:
  115. ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
  116. ; a specific port;
  117. ; 'port' - to listen on a TCP socket to all addresses on a
  118. ; specific port;
  119. ; '/path/to/unix/socket' - to listen on a unix socket.
  120. ; Note: This value is mandatory.
  121. listen = 127.0.0.1:9000
  122. ; Set listen(2) backlog.
  123. ; Default Value: 128 (-1 on FreeBSD and OpenBSD)
  124. ;listen.backlog = 128
  125. ; Set permissions for unix socket, if one is used. In Linux, read/write
  126. ; permissions must be set in order to allow connections from a web server. Many
  127. ; BSD-derived systems allow connections regardless of permissions.
  128. ; Default Values: user and group are set as the running user
  129. ; mode is set to 0666
  130. ;listen.owner = nobody
  131. ;listen.group = nobody
  132. ;listen.mode = 0666
  133. ; List of ipv4 addresses of FastCGI clients which are allowed to connect.
  134. ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
  135. ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
  136. ; must be separated by a comma. If this value is left blank, connections will be
  137. ; accepted from any ip address.
  138. ; Default Value: any
  139. ;listen.allowed_clients = 127.0.0.1
  140. ; Choose how the process manager will control the number of child processes.
  141. ; Possible Values:
  142. ; static - a fixed number (pm.max_children) of child processes;
  143. ; dynamic - the number of child processes are set dynamically based on the
  144. ; following directives. With this process management, there will be
  145. ; always at least 1 children.
  146. ; pm.max_children - the maximum number of children that can
  147. ; be alive at the same time.
  148. ; pm.start_servers - the number of children created on startup.
  149. ; pm.min_spare_servers - the minimum number of children in 'idle'
  150. ; state (waiting to process). If the number
  151. ; of 'idle' processes is less than this
  152. ; number then some children will be created.
  153. ; pm.max_spare_servers - the maximum number of children in 'idle'
  154. ; state (waiting to process). If the number
  155. ; of 'idle' processes is greater than this
  156. ; number then some children will be killed.
  157. ; ondemand - no children are created at startup. Children will be forked when
  158. ; new requests will connect. The following parameter are used:
  159. ; pm.max_children - the maximum number of children that
  160. ; can be alive at the same time.
  161. ; pm.process_idle_timeout - The number of seconds after which
  162. ; an idle process will be killed.
  163. ; Note: This value is mandatory.
  164. pm = dynamic
  165. ; The number of child processes to be created when pm is set to 'static' and the
  166. ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
  167. ; This value sets the limit on the number of simultaneous requests that will be
  168. ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
  169. ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
  170. ; CGI. The below defaults are based on a server without much resources. Don't
  171. ; forget to tweak pm.* to fit your needs.
  172. ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
  173. ; Note: This value is mandatory.
  174. pm.max_children = 5
  175. ; The number of child processes created on startup.
  176. ; Note: Used only when pm is set to 'dynamic'
  177. ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
  178. pm.start_servers = 2
  179. ; The desired minimum number of idle server processes.
  180. ; Note: Used only when pm is set to 'dynamic'
  181. ; Note: Mandatory when pm is set to 'dynamic'
  182. pm.min_spare_servers = 1
  183. ; The desired maximum number of idle server processes.
  184. ; Note: Used only when pm is set to 'dynamic'
  185. ; Note: Mandatory when pm is set to 'dynamic'
  186. pm.max_spare_servers = 3
  187. ; The number of seconds after which an idle process will be killed.
  188. ; Note: Used only when pm is set to 'ondemand'
  189. ; Default Value: 10s
  190. ;pm.process_idle_timeout = 10s;
  191. ; The number of requests each child process should execute before respawning.
  192. ; This can be useful to work around memory leaks in 3rd party libraries. For
  193. ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
  194. ; Default Value: 0
  195. ;pm.max_requests = 500
  196. ; The URI to view the FPM status page. If this value is not set, no URI will be
  197. ; recognized as a status page. It shows the following informations:
  198. ; pool - the name of the pool;
  199. ; process manager - static, dynamic or ondemand;
  200. ; start time - the date and time FPM has started;
  201. ; start since - number of seconds since FPM has started;
  202. ; accepted conn - the number of request accepted by the pool;
  203. ; listen queue - the number of request in the queue of pending
  204. ; connections (see backlog in listen(2));
  205. ; max listen queue - the maximum number of requests in the queue
  206. ; of pending connections since FPM has started;
  207. ; listen queue len - the size of the socket queue of pending connections;
  208. ; idle processes - the number of idle processes;
  209. ; active processes - the number of active processes;
  210. ; total processes - the number of idle + active processes;
  211. ; max active processes - the maximum number of active processes since FPM
  212. ; has started;
  213. ; max children reached - number of times, the process limit has been reached,
  214. ; when pm tries to start more children (works only for
  215. ; pm 'dynamic' and 'ondemand');
  216. ; Value are updated in real time.
  217. ; Example output:
  218. ; pool: www
  219. ; process manager: static
  220. ; start time: 01/Jul/2011:17:53:49 +0200
  221. ; start since: 62636
  222. ; accepted conn: 190460
  223. ; listen queue: 0
  224. ; max listen queue: 1
  225. ; listen queue len: 42
  226. ; idle processes: 4
  227. ; active processes: 11
  228. ; total processes: 15
  229. ; max active processes: 12
  230. ; max children reached: 0
  231. ;
  232. ; By default the status page output is formatted as text/plain. Passing either
  233. ; 'html', 'xml' or 'json' in the query string will return the corresponding
  234. ; output syntax. Example:
  235. ; http://www.foo.bar/status
  236. ; http://www.foo.bar/status?json
  237. ; http://www.foo.bar/status?html
  238. ; http://www.foo.bar/status?xml
  239. ;
  240. ; By default the status page only outputs short status. Passing 'full' in the
  241. ; query string will also return status for each pool process.
  242. ; Example:
  243. ; http://www.foo.bar/status?full
  244. ; http://www.foo.bar/status?json&full
  245. ; http://www.foo.bar/status?html&full
  246. ; http://www.foo.bar/status?xml&full
  247. ; The Full status returns for each process:
  248. ; pid - the PID of the process;
  249. ; state - the state of the process (Idle, Running, ...);
  250. ; start time - the date and time the process has started;
  251. ; start since - the number of seconds since the process has started;
  252. ; requests - the number of requests the process has served;
  253. ; request duration - the duration in s of the requests;
  254. ; request method - the request method (GET, POST, ...);
  255. ; request URI - the request URI with the query string;
  256. ; content length - the content length of the request (only with POST);
  257. ; user - the user (PHP_AUTH_USER) (or '-' if not set);
  258. ; script - the main script called (or '-' if not set);
  259. ; last request cpu - the %cpu the last request consumed
  260. ; it's always 0 if the process is not in Idle state
  261. ; because CPU calculation is done when the request
  262. ; processing has terminated;
  263. ; last request memory - the max amount of memory the last request consumed
  264. ; it's always 0 if the process is not in Idle state
  265. ; because memory calculation is done when the request
  266. ; processing has terminated;
  267. ; If the process is in Idle state, then informations are related to the
  268. ; last request the process has served. Otherwise informations are related to
  269. ; the current request being served.
  270. ; Example output:
  271. ; ************************
  272. ; pid: 31330
  273. ; state: Running
  274. ; start time: 01/Jul/2011:17:53:49 +0200
  275. ; start since: 63087
  276. ; requests: 12808
  277. ; request duration: 1250261
  278. ; request method: GET
  279. ; request URI: /test_mem.php?N=10000
  280. ; content length: 0
  281. ; user: -
  282. ; script: /home/fat/web/docs/php/test_mem.php
  283. ; last request cpu: 0.00
  284. ; last request memory: 0
  285. ;
  286. ; Note: There is a real-time FPM status monitoring sample web page available
  287. ; It's available in: ${prefix}/share/fpm/status.html
  288. ;
  289. ; Note: The value must start with a leading slash (/). The value can be
  290. ; anything, but it may not be a good idea to use the .php extension or it
  291. ; may conflict with a real PHP file.
  292. ; Default Value: not set
  293. ;pm.status_path = /status
  294. ; The ping URI to call the monitoring page of FPM. If this value is not set, no
  295. ; URI will be recognized as a ping page. This could be used to test from outside
  296. ; that FPM is alive and responding, or to
  297. ; - create a graph of FPM availability (rrd or such);
  298. ; - remove a server from a group if it is not responding (load balancing);
  299. ; - trigger alerts for the operating team (24/7).
  300. ; Note: The value must start with a leading slash (/). The value can be
  301. ; anything, but it may not be a good idea to use the .php extension or it
  302. ; may conflict with a real PHP file.
  303. ; Default Value: not set
  304. ;ping.path = /ping
  305. ; This directive may be used to customize the response of a ping request. The
  306. ; response is formatted as text/plain with a 200 response code.
  307. ; Default Value: pong
  308. ;ping.response = pong
  309. ; The access log file
  310. ; Default: not set
  311. ;access.log = log/$pool.access.log
  312. ; The access log format.
  313. ; The following syntax is allowed
  314. ; %%: the '%' character
  315. ; %C: %CPU used by the request
  316. ; it can accept the following format:
  317. ; - %{user}C for user CPU only
  318. ; - %{system}C for system CPU only
  319. ; - %{total}C for user + system CPU (default)
  320. ; %d: time taken to serve the request
  321. ; it can accept the following format:
  322. ; - %{seconds}d (default)
  323. ; - %{miliseconds}d
  324. ; - %{mili}d
  325. ; - %{microseconds}d
  326. ; - %{micro}d
  327. ; %e: an environment variable (same as $_ENV or $_SERVER)
  328. ; it must be associated with embraces to specify the name of the env
  329. ; variable. Some exemples:
  330. ; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
  331. ; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
  332. ; %f: script filename
  333. ; %l: content-length of the request (for POST request only)
  334. ; %m: request method
  335. ; %M: peak of memory allocated by PHP
  336. ; it can accept the following format:
  337. ; - %{bytes}M (default)
  338. ; - %{kilobytes}M
  339. ; - %{kilo}M
  340. ; - %{megabytes}M
  341. ; - %{mega}M
  342. ; %n: pool name
  343. ; %o: ouput header
  344. ; it must be associated with embraces to specify the name of the header:
  345. ; - %{Content-Type}o
  346. ; - %{X-Powered-By}o
  347. ; - %{Transfert-Encoding}o
  348. ; - ....
  349. ; %p: PID of the child that serviced the request
  350. ; %P: PID of the parent of the child that serviced the request
  351. ; %q: the query string
  352. ; %Q: the '?' character if query string exists
  353. ; %r: the request URI (without the query string, see %q and %Q)
  354. ; %R: remote IP address
  355. ; %s: status (response code)
  356. ; %t: server time the request was received
  357. ; it can accept a strftime(3) format:
  358. ; %d/%b/%Y:%H:%M:%S %z (default)
  359. ; %T: time the log has been written (the request has finished)
  360. ; it can accept a strftime(3) format:
  361. ; %d/%b/%Y:%H:%M:%S %z (default)
  362. ; %u: remote user
  363. ;
  364. ; Default: "%R - %u %t \"%m %r\" %s"
  365. ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
  366. ; The log file for slow requests
  367. ; Default Value: not set
  368. ; Note: slowlog is mandatory if request_slowlog_timeout is set
  369. ;slowlog = log/$pool.log.slow
  370. ; The timeout for serving a single request after which a PHP backtrace will be
  371. ; dumped to the 'slowlog' file. A value of '0s' means 'off'.
  372. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
  373. ; Default Value: 0
  374. ;request_slowlog_timeout = 0
  375. ; The timeout for serving a single request after which the worker process will
  376. ; be killed. This option should be used when the 'max_execution_time' ini option
  377. ; does not stop script execution for some reason. A value of '0' means 'off'.
  378. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
  379. ; Default Value: 0
  380. ;request_terminate_timeout = 0
  381. ; Set open file descriptor rlimit.
  382. ; Default Value: system defined value
  383. ;rlimit_files = 1024
  384. ; Set max core size rlimit.
  385. ; Possible Values: 'unlimited' or an integer greater or equal to 0
  386. ; Default Value: system defined value
  387. ;rlimit_core = 0
  388. ; Chroot to this directory at the start. This value must be defined as an
  389. ; absolute path. When this value is not set, chroot is not used.
  390. ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
  391. ; of its subdirectories. If the pool prefix is not set, the global prefix
  392. ; will be used instead.
  393. ; Note: chrooting is a great security feature and should be used whenever
  394. ; possible. However, all PHP paths will be relative to the chroot
  395. ; (error_log, sessions.save_path, ...).
  396. ; Default Value: not set
  397. ;chroot =
  398. ; Chdir to this directory at the start.
  399. ; Note: relative path can be used.
  400. ; Default Value: current directory or / when chroot
  401. ;chdir = /var/www
  402. ; Redirect worker stdout and stderr into main error log. If not set, stdout and
  403. ; stderr will be redirected to /dev/null according to FastCGI specs.
  404. ; Note: on highloaded environement, this can cause some delay in the page
  405. ; process time (several ms).
  406. ; Default Value: no
  407. ;catch_workers_output = yes
  408. ; Limits the extensions of the main script FPM will allow to parse. This can
  409. ; prevent configuration mistakes on the web server side. You should only limit
  410. ; FPM to .php extensions to prevent malicious users to use other extensions to
  411. ; exectute php code.
  412. ; Note: set an empty value to allow all extensions.
  413. ; Default Value: .php
  414. ;security.limit_extensions = .php .php3 .php4 .php5
  415. ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
  416. ; the current environment.
  417. ; Default Value: clean env
  418. ;env[HOSTNAME] = $HOSTNAME
  419. ;env[PATH] = /usr/local/bin:/usr/bin:/bin
  420. ;env[TMP] = /tmp
  421. ;env[TMPDIR] = /tmp
  422. ;env[TEMP] = /tmp
  423. ; Additional php.ini defines, specific to this pool of workers. These settings
  424. ; overwrite the values previously defined in the php.ini. The directives are the
  425. ; same as the PHP SAPI:
  426. ; php_value/php_flag - you can set classic ini defines which can
  427. ; be overwritten from PHP call 'ini_set'.
  428. ; php_admin_value/php_admin_flag - these directives won't be overwritten by
  429. ; PHP call 'ini_set'
  430. ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
  431. ; Defining 'extension' will load the corresponding shared extension from
  432. ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
  433. ; overwrite previously defined php.ini values, but will append the new value
  434. ; instead.
  435. ; Note: path INI options can be relative and will be expanded with the prefix
  436. ; (pool, global or /usr/local/webserver/php)
  437. ; Default Value: nothing is defined by default except the values in php.ini and
  438. ; specified at startup with the -d argument
  439. ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
  440. ;php_flag[display_errors] = off
  441. ;php_admin_value[error_log] = /var/log/fpm-php.www.log
  442. ;php_admin_flag[log_errors] = on
  443. ;php_admin_value[memory_limit] = 32M

[root@omc-0 html]# vim /etc/nginx/nginx.conf

  1. user nginx;
  2. worker_processes 10;
  3. worker_rlimit_nofile 100000;
  4. error_log /var/log/nginx/error.log;
  5. #error_log /var/log/nginx/error.log notice;
  6. #error_log /var/log/nginx/error.log info;
  7. pid /var/run/nginx.pid;
  8. events {
  9. worker_connections 1024;
  10. use epoll;
  11. }
  12. http {
  13. include /etc/nginx/mime.types;
  14. default_type application/octet-stream;
  15. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  16. '$status $body_bytes_sent "$http_referer" '
  17. '"$http_user_agent" "$http_x_forwarded_for"';
  18. access_log /var/log/nginx/access.log main;
  19. sendfile on;
  20. tcp_nopush on;
  21. tcp_nodelay on;
  22. server_tokens off;
  23. gzip on;
  24. gzip_static on;
  25. gzip_comp_level 5;
  26. gzip_min_length 1024;
  27. keepalive_timeout 65;
  28. limit_conn_zone $binary_remote_addr zone=addr:10m;
  29. # Load config files from the /etc/nginx/conf.d directory
  30. include /etc/nginx/conf.d/*.conf;
  31. server {
  32. limit_conn addr 10;
  33. listen 80;
  34. server_name localhost;
  35. #charset koi8-r;
  36. #access_log logs/host.access.log main;
  37. location / {
  38. #root /usr/share/nginx/html;
  39. root /var/www/html;
  40. index index.html index.htm index.php;
  41. }
  42. error_page 404 /404.html;
  43. location = /404.html {
  44. root /usr/share/nginx/html;
  45. }
  46. # redirect server error pages to the static page /50x.html
  47. #
  48. error_page 500 502 503 504 /50x.html;
  49. location = /50x.html {
  50. root /usr/share/nginx/html;
  51. }
  52. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  53. #
  54. #location ~ \.php$ {
  55. # proxy_pass http://127.0.0.1;
  56. #}
  57. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  58. #
  59. location ~ \.php$ {
  60. root /var/www/html;
  61. fastcgi_pass 127.0.0.1:9000;
  62. fastcgi_index index.php;
  63. #fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
  64. fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name;
  65. include fastcgi_params;
  66. }
  67. # deny access to .htaccess files, if Apache's document root
  68. # concurs with nginx's one
  69. #
  70. #location ~ /\.ht {
  71. # deny all;
  72. #}
  73. }
  74. # another virtual host using mix of IP-, name-, and port-based configuration
  75. #
  76. #server {
  77. # listen 8000;
  78. # listen somename:8080;
  79. # server_name somename alias another.alias;
  80. # location / {
  81. # root html;
  82. # index index.html index.htm;
  83. # }
  84. #}
  85. # HTTPS server
  86. #
  87. #server {
  88. # listen 443;
  89. # server_name localhost;
  90. # ssl on;
  91. # ssl_certificate cert.pem;
  92. # ssl_certificate_key cert.key;
  93. # ssl_session_timeout 5m;
  94. # ssl_protocols SSLv2 SSLv3 TLSv1;
  95. # ssl_ciphers HIGH:!aNULL:!MD5;
  96. # ssl_prefer_server_ciphers on;
  97. # location / {
  98. # root html;
  99. # index index.html index.htm;
  100. # }
  101. #}
  102. }

四、查看phpinfo
1.在/var/www/html/下面创建文件phpinfo.php
2.输入内容

  1. <?php
  2. echo phpinfo();
  3. ?>

3.查看http://ipaddress/phpinfo.php

转 安装Nginx 1.2.0+PHP 5.4.3(FastCGI)+MySQL 5.5.24的更多相关文章

  1. ubuntu 15.04 手动安装nginx 1.9.0

    平时工作也用nginx,不过用的时候都是已经配好的,只要简单改改参数就可以了.今天在自己的电脑上安装的时候发现没有想象的那么顺利. 纸上得来终觉浅,绝知此事要躬行. 正题: 1.到nginx下载页面获 ...

  2. Ubuntu 16.04源码编译安装nginx 1.10.0

    一.下载相关的依赖库 pcre 下载地址 http://120.52.73.43/jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.t ...

  3. CentOS 7.4安装Nginx 1.14.0

    一.安装所需环境   1.gcc 安装         yum install gcc-c++    

  4. CentOS7.0安装Nginx 1.10.0

    首先由于nginx的一些模块依赖一些lib库,所以在安装nginx之前,必须先安装这些lib库,这些依赖库主要有g++.gcc.openssl-devel.pcre-devel和zlib-devel ...

  5. CentOS 6.5 下编译安装 Nginx 1.8.0

    转自:https://i.cnblogs.com/EditPosts.aspx?postid=8303227&update=1 安装编译依赖的包 yum -y install gcc gcc- ...

  6. 安装篇四:安装NGINX(1.4.0版本)

    #1.NGINX安装 1.安装文件上传软件 [root@TEST ~]# yum install lrzsz –y <---拖拽文件 2.检查软件安装的系统环境 [root@TEST ~]# c ...

  7. LNMP搭建(CentOS 6.3+Nginx 1.2.0+PHP 5.3.15(fpm)+ MySQL 5.5.35)

    Nginx (“engine x”) 是一个高性能的 HTTP 和反向代理服务器,也是一个 IMAP/POP3/SMTP 代理服务器. Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 ...

  8. CentOS 6.7 编译安装Nginx 1.8.0

    1.配置编译环境 yum update && yum upgrade yum groupinstall "Development Tools" 或者 yum ins ...

  9. Ubuntu 16.04 LTS 安装配置 Nginx 1.10.0 Php7.0-FPM

    1. 安装Nginx,Php-7.0 ~$ sudo add-apt-repository ppa:nginx/stable ~$ sudo apt-get update ~$ sudo apt-ge ...

随机推荐

  1. UML类图和时序图

    这里不会将UML的各种元素都提到,我只想讲讲类图中各个类之间的关系: 能看懂类图中各个类之间的线条.箭头代表什么意思后,也就足够应对 日常的工作和交流: 同时,我们应该能将类图所表达的含义和最终的代码 ...

  2. unix时间戳time_t与UTC时区的关系

    一般我用C写unix时间戳是这样子的 #include<stdio.h> #include<time.h> void printfDateTimeStr(struct tm * ...

  3. JavaScript 实现打印,打印预览,打印设置

    WebBrowser是IE内置的浏览器控件,无需用户下载. 一.WebBrowser控件 <object ID='WebBrowser' WIDTH=0 HEIGHT=0 CLASSID='CL ...

  4. Android -- setWillNotDraw()

    干货 处理onDraw()方法不被执行的解决方法: setWillNotDraw(false); 官方文档的解释: If this view doesn't do any drawing on its ...

  5. F分布

    定义:设X1服从自由度为m的χ2分布,X2服从自由度为n的χ2分布,且X1.X2相互独立,则称变量F=(X1/m)/(X2/n)所服从的分布为F分布,其中第一自由度为m,第二自由度为n.[1] F分布 ...

  6. telnet 163发送邮件

    1.telnet smtp.163.com 25 2. 3.测试成功

  7. 火星坐标、百度坐标、WGS84坐标转换代码(JS、python版)

    火星坐标.百度坐标.WGS84坐标转换代码(JS.python版) 一.JS版本源码 github:https://github.com/wandergis/coordTransform /** * ...

  8. Android 开源项目 eoe 社区 Android 客户端

    本文内容 环境 开源项目 eoe 社区 Android 客户端 本文介绍 eoe 社区 Android 客户端.它是一个开源项目,功能相对简单,采用侧边菜单栏.可以学习一下.点击此处查看 GitHub ...

  9. Oracle ODP.NET vs Microsoft MSDP

    08年做项目时,用 VS 2005,写据库层还在用 MSDP(System.Data.OracleClient),但是当时由于要操作 XML 和二进制文件,所以又使用了 ODP.NET(Oracle. ...

  10. Asp.Net 之 禁用TextBox的记忆功能

    IE提供了一个自动完成功能可以记忆我们的输入内容(如登录帐号等),方便下一次快速地录入类似资料.这确实是一个非常友好的功能,在操作时只需用鼠标双击文本框或输入前几个字符,系统会自动列出以前的录入历史供 ...