实战:Nginx+TCMalloc+PHP
(1)
[root@localhost ~]# yum -y install *gcc*
[root@localhost ~]# rpm -qa | grep openssl-devel
openssl-devel-0.9.8e-12.el5
[root@localhost ~]# rpm -qa | grep zlib-devel
zlib-devel-1.2.3-3
(2)
[root@localhost install]# tar -zxvf pcre-8.02.tar.gz -C /usr/src/
[root@localhost install]# cd /usr/src/
[root@localhost src]# cd pcre-8.02/
[root@localhost pcre-8.02]# ./configure
[root@localhost pcre-8.02]#make && make install
(3)
[root@localhost install]# tar -zxvf nginx-0.7.65.tar.gz -C /usr/src/
[root@localhost install]# cd /usr/src/nginx-0.7.65/
[root@localhost nginx-0.7.65]# ./configure --prefix=/usr/local/nginx --with-
http_stub_status_module --with-http_gzip_static_module
[root@localhost nginx-0.7.65]# make
[root@localhost nginx-0.7.65]# make install
[root@localhost nginx-0.7.65]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/0.7.65
configure arguments: --prefix=/usr/local/nginx --with-http_stub_status_module --with-
http_gzip_static_module
[root@localhost conf]# vim nginx.conf
1
2 user nobody;
3 worker_processes 1;
4
5 #error_log logs/error.log;
6 #error_log logs/error.log notice;
7 error_log logs/error.log info;
8
9 pid logs/nginx.pid;
10
11
12 events {
13 worker_connections 1024;
14 }
15
16
17 http {
18 include mime.types;
19 default_type application/octet-stream;
20
21 log_format main '$remote_addr - $remote_user [$time_local] "$request" '
22 '$status $body_bytes_sent "$http_referer" '
23 '"$http_user_agent" "$http_x_forwarded_for"';
24
25 #access_log logs/access.log main;
26
27 sendfile on;
28 #tcp_nopush on;
29
30 #keepalive_timeout 0;
31 keepalive_timeout 65;
32
33 #gzip on;
34
35 server {
36 listen 80;
37 server_name localhost;
38
39 #charset koi8-r;
40
41 access_log logs/host.access.log main;
42
43 location / {
44 root html;
45 index index.html index.htm;
46 }
47
48 #error_page 404 /404.html;
49
50 # redirect server error pages to the static page /50x.html
51 #
52 error_page 500 502 503 504 /50x.html;
53 location = /50x.html {
54 root html;
55 }
开启服务
[root@localhost conf]# /usr/local/nginx/sbin/nginx
[root@localhost conf]# ps -ef | grep nginx
root 10890 1 0 21:40 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nobody 10891 10890 0 21:40 ? 00:00:00 nginx: worker process
root 10893 3874 0 21:40 pts/0 00:00:00 grep nginx
关闭服务
[root@localhost conf]# ps -ef | grep nginx
root 10890 1 0 21:40 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nobody 10891 10890 0 21:40 ? 00:00:00 nginx: worker process
root 10906 3874 0 21:44 pts/0 00:00:00 grep nginx
[root@localhost conf]# kill 10890
本文出自 “dsafsa_技术博客” 博客,转载请与作者联系!