目录[-]
|
1
|
yum -y installgccgcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libtool libtool-ltdl |
|
1
2
3
4
5
6
|
cd/usr/local/srcwget https://bitbucket.org/pierrejoye/gd-libgd/get/5551f61978e3.tar.gztarxzvf 5551f61978e3.tar.gzcdpierrejoye-gd-libgd-5551f61978e3/src./configuremake&& makeinstall |
|
1
2
3
4
5
6
7
8
9
|
wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.17-linux2.6-i686.tar.gz/from/http://mysql.ntu.edu.tw/wget http://cn.php.net/get/php-5.2.17.tar.gz/from/tw.php.net/mirrorwget http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gzwget http://nginx.org/download/nginx-1.0.4.tar.gz#rpm -ivh nginx-1.0.8-2.el5.ngx.i386.rpmwget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gzwget http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?modtime=1171868460&big_mirror=0wget http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz?modtime=1194463373&big_mirror=0wget http://blog.s135.com/soft/linux/nginx_php/mhash/mhash-0.9.9.9.tar.gz |
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
tarzxvf libiconv-1.13.1.tar.gzcdlibiconv-1.13.1/./configure--prefix=/usr/localmakemakeinstallcd../tarzxvf libmcrypt-2.5.8.tar.gzcdlibmcrypt-2.5.8/./configuremakemakeinstall/sbin/ldconfigcdlibltdl/./configure--enable-ltdl-installmakemakeinstallcd../../tarzxvf mhash-0.9.9.9.tar.gzcdmhash-0.9.9.9/./configuremakemakeinstallcd../ln-s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.laln-s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.soln-s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4ln-s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8ln-s /usr/local/lib/libmhash.a /usr/lib/libmhash.aln-s /usr/local/lib/libmhash.la /usr/lib/libmhash.laln-s /usr/local/lib/libmhash.so /usr/lib/libmhash.soln-s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2ln-s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1ln-s /usr/local/bin/libmcrypt-config/usr/bin/libmcrypt-configtarzxvf mcrypt-2.6.8.tar.gzcdmcrypt-2.6.8//sbin/ldconfig./configuremakemakeinstallcd../ |
|
1
2
3
4
5
6
7
8
9
|
/usr/sbin/groupaddmysql/usr/sbin/useradd-g mysql -s /sbin/nologinmysqltarzxvf mysql-5.5.3-m3.tar.gzcdmysql-5.5.3-m3/./configure--prefix=/usr/local/mysql/--enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=partition,innobase,myisammrgmake&& makeinstallchmod+w /usr/local/mysqlchown-R mysql:mysql /usr/local/mysqlcd../ |
|
1
2
3
4
|
mkdir-p /var/mysql/data/mkdir-p /var/mysql/binlog/mkdir-p /var/mysql/relaylog/chown-R mysql:mysql /var/mysql/ |
|
1
2
|
/usr/local/mysql/bin/mysql_install_db--basedir=/usr/local/mysql--datadir=/var/mysql/data--user=mysql/usr/local/mysql/bin/mysql_install_db--basedir=/usr/local/mysql--datadir=/var/mysql/data--user=mysql |
|
1
|
vi/var/mysql/my.cnf |
|
1
|
/usr/local/mysql/bin/mysqld_safe--user=root |
|
1
2
3
|
GRANT ALL PRIVILEGES ON *.* TO ‘admin‘@‘localhost‘IDENTIFIED BY ‘12345678‘;GRANT ALL PRIVILEGES ON *.* TO ‘admin‘@‘127.0.0.1‘IDENTIFIED BY ‘12345678‘;GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘IDENTIFIED BY ‘root‘; |
|
1
|
vi/var/mysql/mysql |
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#!/bin/shmysql_port=3306mysql_username="root"mysql_password="root"function_start_mysql(){ printf"Starting MySQL...\n" /usr/local/mysql/bin/mysqld_safe--defaults-file=/var/mysql/my.cnf 2>&1 > /var/mysql/binlog/start.log & }function_stop_mysql(){ printf"Stoping MySQL...\n" /usr/local/mysql/bin/mysqladmin-u ${mysql_username} -p${mysql_password} -S /tmp/mysql.sock shutdown}function_restart_mysql(){ printf"Restarting MySQL...\n" function_stop_mysql sleep5 function_start_mysql}function_kill_mysql(){ kill-9 $(ps-ef | grep ‘bin/mysqld_safe‘ | grep ${mysql_port} | awk ‘{printf $2}‘) kill-9 $(ps-ef | grep ‘libexec/mysqld‘ | grep ${mysql_port} | awk ‘{printf $2}‘)}if[ "$1"= "start"]; then function_start_mysqlelif[ "$1"= "stop"]; then function_stop_mysqlelif[ "$1"= "restart"]; thenfunction_restart_mysqlelif[ "$1"= "kill"]; thenfunction_kill_mysqlelse printf"Usage: /var/mysql/mysql {start|stop|restart|kill}\n"fi |
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
tarzxvf php-5.2.17.tar.gzgzip-cdphp-5.2.17-fpm-0.5.14.diff.gz | patch -d php-5.2.17 -p1cdphp-5.2.17./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-iconv-dir=/usr/local--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib --with-libxml-dir=/usr--enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --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-soapmakeZEND_EXTRA_LIBS=‘-liconv‘makeinstallcpphp.ini-dist /usr/local/php/etc/php.inicd../wget http://blog.s135.com/soft/linux/nginx_php/memcache/memcache-2.2.5.tgzwget http://blog.s135.com/soft/linux/nginx_php/pcre/pcre-8.10.tar.gzwget http://blog.s135.com/soft/linux/nginx_php/eaccelerator/eaccelerator-0.9.6.1.tar.bz2wget http://blog.s135.com/soft/linux/nginx_php/pdo/PDO_MYSQL-1.0.2.tgzwget http://blog.s135.com/soft/linux/nginx_php/imagick/ImageMagick.tar.gzwget http://blog.s135.com/soft/linux/nginx_php/imagick/imagick-2.3.0.tgz |
|
1
2
3
4
5
6
7
|
tarzxvf memcache-2.2.5.tgzcdmemcache-2.2.5//usr/local/php/bin/phpize./configure--with-php-config=/usr/local/php/bin/php-configmakemakeinstallcd../ |
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
tarzxvf pcre-8.10.tar.gzcdpcre-8.10/./configuremake&& makeinstallcd../tarjxvf eaccelerator-0.9.6.1.tar.bz2cdeaccelerator-0.9.6.1//usr/local/php/bin/phpize./configure--enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-configmakemakeinstallcd../tarzxvf PDO_MYSQL-1.0.2.tgzcdPDO_MYSQL-1.0.2//usr/local/php/bin/phpize./configure--with-php-config=/usr/local/php/bin/php-config--with-pdo-mysql=/usr/local/mysqlmakemakeinstallcd../tarzxvf ImageMagick.tar.gzcdImageMagick-6.5.1-2/./configuremakemakeinstallcd../tarzxvf imagick-2.3.0.tgzcdimagick-2.3.0//usr/local/php/bin/phpize./configure--with-php-config=/usr/local/php/bin/php-configmakemakeinstallcd../ |
|
1
2
3
|
extension = "memcache.so"extension = "pdo_mysql.so"extension = "imagick.so" |
|
1
2
3
4
|
sed-i ‘s#extension_dir = "./"#extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"\nextension = "memcache.so"\nextension = "pdo_mysql.so"\nextension = "imagick.so"\n#‘/usr/local/php/etc/php.inised-i ‘s#output_buffering = Off#output_buffering = On#‘/usr/local/php/etc/php.inised-i "s#; always_populate_raw_post_data = On#always_populate_raw_post_data = On#g"/usr/local/php/etc/php.inised-i "s#; cgi.fix_pathinfo=0#cgi.fix_pathinfo=0#g"/usr/local/php/etc/php.ini |
|
1
2
3
4
5
6
7
8
9
10
|
/usr/sbin/groupaddwww/usr/sbin/useradd-g www wwwmkdir-p /var/webroot/logchmod+w /var/webroot/logchown-R www:www /var/webroot/logmkdir-p /var/webroot/webchmod+w /var/webroot/webchown-R www:www /var/webroot/webchown-R admin:ftpgroup /var/webroot/web |
|
1
2
3
|
mkdir-p /var/log/nginxchmod+w /var/log/nginxchown-R www:www /var/log/nginx |
|
1
2
|
rm-f /usr/local/nginx/conf/nginx.confvi/usr/local/nginx/conf/nginx.conf |
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
user www www;#Specifies the value for maximum file descriptors that can be opened by this process.worker_rlimit_nofile 65535;#user nobody;worker_processes 8;#error_log /var/log/nginx/error.log;#error_log /var/log/nginx/error.log notice;#error_log /var/log/nginx/error.log info;error_log /var/log/nginx/nginx_error.log crit;pid /usr/local/nginx/nginx.pid;events { use epoll; worker_connections 65535;}http { include mime.types; default_type application/octet-stream; log_format main ‘$remote_addr - $remote_user [$time_local] "$request" ‘ ‘$status $body_bytes_sent "$http_referer" ‘ ‘"$http_user_agent" "$http_x_forwarded_for"‘; access_log /var/webroot/log/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 8m; 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; gzipon; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.0; gzip_comp_level 2; gzip_types text/plainapplication/x-javascripttext/cssapplication/xml; gzip_vary on; #gzip on; server { listen 80; server_name localhost; #charset koi8-r; #access_log /var/webroot/log/host.access.log main; location / { root /var/webroot/web; index index.html index.htm index.php; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root /var/webroot/web; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; #include fastcgi_params; include fcgi.conf; } # deny access to .htaccess files, if Apache‘s document root # concurs with nginx‘s one # location ~ /\.ht { deny all; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 1h; } } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443; # server_name localhost; # ssl on; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_timeout 5m; # ssl_protocols SSLv2 SSLv3 TLSv1; # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #}} |
|
1
|
vi/usr/local/nginx/conf/fcgi.conf |
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#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-redirectfastcgi_param REDIRECT_STATUS 200; |
|
1
2
|
ulimit-SHn 65535/usr/local/nginx/sbin/nginx |
|
1
|
vi/etc/rc.local |
|
1
2
3
4
|
ulimit-SHn 65535/usr/local/php/sbin/php-fpmstart/usr/local/nginx/sbin/nginx/var/mysql/mysqlstart |
|
1
|
/usr/local/nginx/sbin/nginx-t |
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
the configuration file /usr/local/nginx/conf/nginx.conf was tested successfully
|
1
|
/usr/local/nginx/sbin/nginx-s reload |
|
1
|
ps-ef | grep"nginx: master process"| grep-v"grep"| awk-F ‘ ‘‘{print $2}‘ |
|
1
|
kill-HUP 6302 |
|
1
|
kill-HUP `cat/usr/local/nginx/nginx.pid` |
|
1
|
vi/etc/sysctl.conf |
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# Addnet.ipv4.tcp_max_syn_backlog = 65536net.core.netdev_max_backlog = 32768net.core.somaxconn = 32768net.core.wmem_default = 8388608net.core.rmem_default = 8388608net.core.rmem_max = 16777216net.core.wmem_max = 16777216net.ipv4.tcp_timestamps = 0net.ipv4.tcp_synack_retries = 2net.ipv4.tcp_syn_retries = 2net.ipv4.tcp_tw_recycle = 1#net.ipv4.tcp_tw_len = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_mem = 94500000 915000000 927000000net.ipv4.tcp_max_orphans = 3276800#net.ipv4.tcp_fin_timeout = 30#net.ipv4.tcp_keepalive_time = 120net.ipv4.ip_local_port_range = 1024 65535 |
原文:http://www.cnblogs.com/liaocheng/p/4243583.html