install_lnmp.sh

#!/bin/bash
HADOOP_SW=/home/hadoop/sa/sw
if test ! -d ${HADOOP_SW};then
mkdir -p ${HADOOP_SW}
fi
MYSQL_HOME=/opt/mysql
MYSQL_HOME_VERSION=${MYSQL_HOME}-5.1.62
PHP_HOME=/opt/php PHP_HOME_VERSION=${PHP_HOME}-5.2.17

cat >> /etc/profile<<EOF
export HADOOP_SW=/home/hadoop/sa/sw
export MYSQL_HOME=/opt/mysql
export MYSQL_HOME_VERSION=${MYSQL_HOME}-5.1.62
export PHP_HOME=/opt/php
export PHP_HOME_VERSION=${PHP_HOME}-5.2.17
EOF

#download
cd ${HADOOP_SW}
wget 'http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.62.tar.gz/from/http://ftp.jaist.ac.jp/pub/mysql/' -O ${HADOOP_SW}/mysql-5.1.62.tar.gz
wget http://ftp.gnu.org/gnu/libiconv/libiconv-1.13.1.tar.gz -O ${HADOOP_SW}/libiconv-1.13.1.tar.gz
wget 'http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.bz2/download' -O ${HADOOP_SW}/libmcrypt-2.5.8.tar.bz2
wget http://sourceforge.net/projects/mhash/files/mhash/0.8.15/mhash-0.8.15.tar.gz/download -O ${HADOOP_SW}/mhash-0.8.15.tar.gz
wget http://xmlsoft.org/sources/libxml2-2.7.2.tar.gz -O ${HADOOP_SW}/libxml2-2.7.2.tar.gz
wget http://sourceforge.net/projects/libpng/files/zlib/1.2.5/zlib-1.2.5.tar.gz -O ${HADOOP_SW}/zlib-1.2.5.tar.gz
wget http://dnamp.googlecode.com/files/libpng-1.5.1.tar.gz -O ${HADOOP_SW}/libpng-1.5.1.tar.gz
wget http://www.imagemagick.org/download/delegates/jpegsrc.v8.tar.gz -O ${HADOOP_SW}/jpegsrc.v8.tar.gz
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.3.10.tar.bz2 -O ${HADOOP_SW}/freetype-2.3.10.tar.bz2
wget http://pkgs.fedoraproject.org/repo/pkgs/freetype/freetype-2.3.10.tar.bz2/b7a8a26cc137716a32b788664697d727/freetype-2.3.10.tar.bz2 -O ${HADOOP_SW}/freetype-2.3.10.tar.bz2
wget http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz -O ${HADOOP_SW}/mcrypt-2.6.8.tar.gz
wget http://autoapm.googlecode.com/files/gd-2.0.33.tar.gz -O ${HADOOP_SW}/gd-2.0.33.tar.gz
wget http://archive.apache.org/dist/apr/apr-1.4.2.tar.gz -O ${HADOOP_SW}/apr-1.4.2.tar.gz
wget 'http://sourceforge.net/projects/pcre/files/pcre/8.30/pcre-8.30.tar.bz2/download' -O ${HADOOP_SW}/pcre-8.30.tar.bz2
wget http://nginx.org/download/nginx-1.0.14.tar.gz -O ${HADOOP_SW}/nginx-1.0.14.tar.gz
wget http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz -O ${HADOOP_SW}/php-5.2.17-fpm-0.5.14.diff.gz
wget http://museum.php.net/php5/php-5.2.10.tar.gz -O ${HADOOP_SW}/php-5.2.10.tar.gz
wget http://museum.php.net/php5/php-5.2.17.tar.bz2 -O ${HADOOP_SW}/php-5.2.17.tar.bz2
wget http://pecl.php.net/get/memcache-2.2.5.tgz -O ${HADOOP_SW}/memcache-2.2.5.tgz
wget http://lnmp-id.googlecode.com/files/eaccelerator-0.9.5.3.tar.bz2 -O ${HADOOP_SW}/eaccelerator-0.9.5.3.tar.bz2
wget http://vps.googlecode.com/files/PDO_MYSQL-1.0.2.tgz -O ${HADOOP_SW}/PDO_MYSQL-1.0.2.tgz
wget 'http://sourceforge.net/projects/imagemagick/files/old-sources/6.x/6.7/ImageMagick-6.7.5-10.tar.gz/download' -O ${HADOOP_SW}/ImageMagick-6.7.5-10.tar.gz
wget http://pecl.php.net/get/imagick-3.1.0RC1.tgz -O ${HADOOP_SW}/imagick-3.1.0RC1.tgz
axel -n 40 http://www.openssl.org/source/openssl-1.0.1e.tar.gz

#for mysql
groupadd mysql
useradd -g mysql mysql
tar zxf mysql-5.1.62.tar.gz
cd mysql-5.1.62/
./configure --prefix=/opt/mysql-5.1.62/ --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=innobase
make && make install ln -s /opt/mysql-5.1.62 /opt/mysql chmod -R 755 /opt/mysql* chown -R mysql:mysql /opt/mysql* /opt/mysql/bin/mysql_install_db --basedir=/opt/mysql --datadir=/opt/mysql/data --user=mysql cp -af support-files/mysql.server /etc/init.d/mysqld chmod 755 /etc/init.d/mysqld

#install php prepair lib

#install libiconv cd ${HADOOP_SW} tar zxf libiconv-1.13.1.tar.gz cd libiconv-1.13.1 && ./configure --prefix=/opt/libiconv && make && make install cd ../

#install libmcrypt tar jxf libmcrypt-2.5.8.tar.bz2 cd libmcrypt-2.5.8 && ./configure --prefix=/opt/libmcrypt && make && make install cat > /etc/ld.so.conf.d/php_lib.conf<<EOF /opt/libiconv/lib /opt/libmcrypt/lib /opt/pcre/lib EOF /sbin/ldconfig #check libltdl cd libltdl/ && ./configure --prefix=/opt/libmcrypt/libltdl --enable-ltdl-install && make && make install cd http://www.cnblogs.com/

#install mhash tar zxf mhash-0.8.15.tar.gz cd mhash-0.8.15/ && /sbin/ldconfig && ./configure --prefix=/opt/mhash && make && make install cd ../

#install libxml2 tar zxf libxml2-2.7.2.tar.gz cd libxml2-2.7.2/ && ./configure --prefix=/opt/libxml2 && make && make install cd ../

#install zlib tar zxf zlib-1.2.5.tar.gz cd zlib-1.2.5/ && ./configure --prefix=/opt/zlib && make && make install cd ../

#install libphg tar zxf libpng-1.5.1.tar.gz cd libpng-1.5.1 && LDFLAGS='-L/opt/zlib/lib/' && ./configure --prefix=/opt/libpng --with-zlib-prefix=/opt/zlib/ && make && make install cd ../

#install jpegsrc.v8.tar.gz tar zxf jpegsrc.v8.tar.gz cd jpeg-8/ && ./configure --prefix=/opt/jpeg && make && make install cd ../

#install freetype tar jxf freetype-2.3.10.tar.bz2 cd freetype-2.3.10/ && ./configure --prefix=/opt/freetype && make && make install cd ../

#install_mcrypt #check mhash mhash_devel yum -y install mhash mhash-devel libtool-ltdl libtool-ltdl-devel if rpm -q mhash;then yum -y install mhash fi

if rpm -q mhash-devel;then yum -y install mhash-devel fi

if ! rpm -q libltdl-ltdl;then yum -y install libtool-ltdl fi

tar zxf mcrypt-2.6.8.tar.gz cd mcrypt-2.6.8/ && CPPFLAGS='-I/opt/libmcrypt/include/' LDFLAGS='-L/opt/libmcrypt/lib/' && ./configure --prefix=/opt/mcrypt --with-libmcrypt-prefix=/opt/libmcrypt && make && make install cd ../

#install gd2
tar zxf gd-2.0.33.tar.gz cd gd-2.0.33/ && CPPFLAGS='-I/opt/libpng/include/' && ./configure --prefix=/opt/gd2 --with-zlib=/opt/zlib --with-jpeg=/opt/jpeg --with-png=/opt/libpng --with-freetype=/opt/freetype && make && make install cd ../

#check libevent
if ! rpm -q libevent;then
yum -y install libevent
fi
if ! rpm -q libevent-devel;then
yum -y install libevent-devel
fi
if ! rpm -q libxml2-dev;then
yum -y install libxml2-dev
fi

#install_apr
tar zxf apr-1.4.2.tar.gz cd apr-1.4.2/ && ./configure --prefix=/opt/apr && make && make install cd ../

#install nginx
tar jxf pcre-8.30.tar.bz2 cd pcre-8.30 && ./configure --prefix=/opt/pcre && make && make install
cd ../ mkdir /opt/nginx-1.0.14
ln -s /opt/nginx-1.0.14 /opt/nginx
tar -zxf nginx-1.0.14.tar.gz
cd nginx-1.0.14/ && ./configure --prefix=/opt/nginx --with-http_ssl_module --with-http_stub_status_module --with-pcre=../pcre-8.30 --with-openssl=../openssl-1.0.1e/
cd ../

#install php for nginx #
yum -y install libevent libevent-devel libxml2-dev
. /etc/profile
ln -s ${PHP_HOME_VERSION} ${PHP_HOME}
tar jxf php-5.2.17.tar.bz2
gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -d php-5.2.17 -p1
cd php-5.2.17 && ./configure --prefix=${PHP_HOME_VERSION} --with-mysqli=${MYSQL_HOME}/bin/mysql_config --with-config-file-path=${PHP_HOME_VERSION}/etc --with-iconv-dir=/opt/libiconv --with-freetype-dir=/opt/freetype --with-jpeg-dir=/opt/jpeg --with-png-dir=/opt/libpng --with-zlib=/opt/zlib --with-libxml-dir=/opt/libxml2 --with-mcrypt=/opt/libmcrypt --with-gd=/opt/gd2 --with-mhash=/opt/mhash --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 --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --without-pear && make && make install
\cp php.ini-dist ${PHP_HOME}/etc/php.ini
\cp -af ./sapi/cgi/fpm/php-fpm /etc/init.d/php-fpm cd ../

#conf Php Extension And Application Repository
curl http://pear.php.net/go-pear.phar | ${PHP_HOME}/bin/php

#install php extended modules
tar zxf memcache-2.2.5.tgz
cd memcache-2.2.5/
${PHP_HOME}/bin/phpize
./configure --with-php-config=${PHP_HOME}/bin/php-config && make && make install cd ../
#提示信息: #Installing shared extensions: ${PHP_HOME}/lib/php/extensions/no-debug-non-zts-20060613/

#install eaccelerator
tar jxf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3/
${PHP_HOME}/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=${PHP_HOME}/bin/php-config && make && make install cd ../
#提示信息: #Installing shared extensions: ${PHP_HOME}/lib/php/extensions/no-debug-non-zts-20060613/

#install PDO_MYSQL
tar zxf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2/
${PHP_HOME}/bin/phpize
./configure --with-php-config=${PHP_HOME}/bin/php-config --with-pdo-mysql=${MYSQL_HOME}/ && make && make install cd ../
#提示信息 #Installing shared extensions: ${PHP_HOME}/lib/php/extensions/no-debug-non-zts-20060613/

#install ImageMagick
tar zxf ImageMagick-6.7.5-10.tar.gz
cd ImageMagick-6.7.5-10/
./configure --prefix=/opt/ImageMagick && make && make install cd ../

#install imagick
tar zxf imagick-3.1.0RC1.tgz
cd imagick-3.1.0RC1/
${PHP_HOME}/bin/phpize
CPPFLAGS='-I/opt/ImageMagick/include/ImageMagick'
./configure --with-imagick=/opt/ImageMagick --with-php-config=${PHP_HOME}/bin/php-config && make && make install cd ../
#提示信息 #Installing shared extensions: ${PHP_HOME}/lib/php/extensions/no-debug-non-zts-20060613/ #Installing header files: ${PHP_HOME}/include/php/

#配置eAccelerator加速PHP:
mkdir -p /var/eaccelerator_cache
cat >> ${PHP_HOME}/etc/php.ini <<EOF
[eaccelerator]
zend_extension="${PHP_HOME}/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="64"
eaccelerator.cache_dir="/var/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="3600"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9" EOF

#conf php.ini
sed -i "s|extension_dir = \"\./\"|extension_dir = \"${PHP_HOME}/lib/php/extensions/no-debug-non-zts-20060613/\"|g" /opt/php/etc/php.ini
sed -i "/extension_dir =/ a\extension = \"memcache.so\"\nextension = \"pdo_mysql.so\"\n" /opt/php/etc/php.ini
#sed -i "/extension_dir =/ a\extension = \"memcache.so\"\nextension = \"pdo_mysql.so\"\nextension = \"imagick.so\"\n" /opt/php/etc/php.ini

#conf php-fpm.conf
cat > ${PHP_HOME}/etc/php-fpm.conf <<EOF
<?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">/opt/php/logs/php-fpm.pid</value>

Error log file <value name="error_log">/opt/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">nobody</value>

Unix group of processes <value name="group">nobody</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">65535</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">102400</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">/opt/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>
EOF

#for mysql
mv /etc/my.cnf /etc/my.cnf.bak.2012.05.07
cat > /etc/my.cnf <<EOF
[mysql] prompt="(\u:come on mysql!:)[\d]> "
no-auto-rehash

[mysqld]
default-character-set = utf8
user = mysql
port = 3306
socket = /tmp/mysql.sock
basedir = /opt/mysql/
datadir = /opt/mysql/data
open_files_limit = 10240
back_log = 600
max_connections = 3000
max_connect_errors = 6000
table_cache = 614
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 300
thread_concurrency = 8
query_cache_size = 32M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
default-storage-engine = MyISAM
default_table_type = MyISAM
thread_stack = 192K
transaction_isolation = READ-COMMITTED
tmp_table_size = 246M
max_heap_table_size = 246M
long_query_time = 1
log_long_format
log-bin = binlog
binlog_cache_size = 4M
binlog_format = MIXED
max_binlog_cache_size = 8M
max_binlog_size = 512M
expire_logs_days = 7
key_buffer_size = 256M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_max_extra_sort_file_size = 10G
myisam_repair_threads = 1 myisam_recover
skip-name-resolve master-connect-retry = 10
slave-skip-errors = 1032,1062,126,1114,1146,1048,1396
server-id = 1
innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 2048M
innodb_data_file_path = ibdata1:1024M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 128M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120 pcre-8.30.tar.bz2
innodb_file_per_table = 0
[mysqldump]
quick max_allowed_packet = 32M
EOF

/opt/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf -u mysql &
mysql -uroot mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' IDENTIFIED BY '12345678@55tuan.com';GRANT ALL PRIVILEGES ON *.* TO 'admin'@'127.0.0.1' IDENTIFIED BY '12345678@55tuan.com';flush privileges;"

cat > /opt/mysql/bin/mysqld_init.sh <<EOF
#!/bin/sh
. /etc/profile
export PATH
. /etc/init.d/functions
mysql_port=3306
mysql_username="admin"
mysql_password="12345678"
mysql_basedir="/opt/mysql"

function_start_mysql() {
printf "Starting MySQL...\n"
/bin/sh ${mysql_basedir}/bin/mysqld_safe --defaults-file=${mysql_basedir}/my.cnf 2>&1 > /dev/null &
}

function_stop_mysql() {
printf "Stoping MySQL...\n"
${mysql_basedir}/bin/mysqladmin -u ${mysql_username} -p${mysql_password} -S /tmp/mysql.sock shutdown
}

function_restart_mysql() {
printf "Restarting MySQL...\n"
function_stop_mysql
sleep 5
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_mysql
elif [ "$1" = "stop" ]; then
function_stop_mysql
elif [ "$1" = "restart" ]; then
function_restart_mysql
elif [ "$1" = "kill" ]; then
function_kill_mysql
else
printf "Usage: ${mysql_basedir}/mysql_php.sh {start|stop|restart|kill}\n" fi
EOF

#for nginx
cat > /opt/nginx/conf/nginx.conf <<EOF
user nobody nobody;
worker_processes 16;
error_log /opt/nginx/logs/nginx_error.log crit;
pid /opt/nginx/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process. worker_rlimit_nofile 655350;

events {
use epoll;
worker_connections 65535;
}

http {
include mime.types;
default_type application/octet-stream;
#charset gb2312;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
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 hive115.hadoop;
index index.html index.htm index.php;
root /sa/sw/www;

location ~ .*\.(php|php5)?$ {
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000; f
astcgi_index index.php;
include fcgi.conf;
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}

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

log_format wwwlogs '\$remote_addr - \$remote_user [\$time_local] "\$request" ' '\$status \$body_bytes_sent "\$http_referer" ' '"\$http_user_agent" \$http_x_forwarded_for'; access_log logs/wwwlogs.log wwwlogs; }

server {
listen 80;
server_name status.hive115.hadoop;

location / { stub_status on; access_log off;
}
}
}
EOF

cat > /opt/nginx/conf/fcgi.conf <<EOF
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;
EOF

cat > /etc/ld.so.conf.d/php_lib.conf <<EOF
/opt/libiconv/lib/
/opt/libmcrypt/lib/
/opt/mhash/lib/
/opt/zlib/lib/
/opt/libpng/lib/
/opt/libxml2/lib/
/opt/jpeg/lib/
/opt/freetype/lib/
/opt/gd2/lib/
/opt/apr/lib/
EOF

ldconfig

#init

/opt/nginx/sbin/nginx
/opt/php/sbin/php-fpm start

posted @ 2013-05-28 18:42  企图穿越  阅读(236)  评论(0编辑  收藏  举报