RHEL6 lnmp

1. Install mysql
yum remove mysql php httpd
yum -y install gcc gcc-c++ make ncurses-devel bison openssl-devel zlib-devel cmake
tar xf mysql-5.5.12.tar.gz
cd mysql-5.5.12
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
 -DMYSQL_DATADIR=/usr/local/mysql/data \
 -DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock \
 -DWITH_MYISAM_STORAGE_ENGINE=1 \
 -DWITH_INNOBASE_STORAGE_ENGINE=1 \
 -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
 -DWITH_PARTITION_STORAGE_ENGINE=1 \
 -DENABLED_LOCAL_INFILE=1 \
 -DWITH_READLINE=1 \
 -DWITH_SSL=yes -DDEFAULT_CHARSET=utf8 \
 -DDEFAULT_COLLATION=utf8_general_ci \
 -DEXTRA_CHARSETS=all \
 -DMYSQL_TCP_PORT=3306
make && make install
useradd -M -s /sbin/nologin mysql
chown -R mysql:mysql /usr/local/mysql
cd /usr/local/mysql/
cp support-files/my-large.cnf /etc/my.cnf
scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
chown -R root .
chown -R mysql data
cp support-files/mysql.server /etc/init.d/mysqld
/etc/init.d/mysqld start
chkconfig mysqld on
echo "export PATH=\$PATH:/usr/local/mysql/bin" >> ~/.bash_profile
source ~/.bash_profile
mysql_secure_installation

2. Install php
tar xf libmcrypt-2.5.8.tar.bz2
cd libmcrypt-2.5.8
./configure --libdir=/usr/lib64
make && make install
cd litltdl
./configure --libdir=/usr/lib64 --enable-ltdl-install
make && make install

yum -y install net-snmp-devel curl-devel libxml2-devel libpng-devel libjpeg-devel freetype-devel gmp-devel
useradd -M -s /sbin/nologin www
tar xf php-5.3.6.tar.bz2
cd php-5.3.6
ln -s /usr/local/mysql/lib /usr/local/mysql/lib64
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-openssl --with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir --with-png-dir --with-jpeg-dir --with-freetype-dir --with-pear --with-gettext --with-gmp --with-mcrypt --enable-inline-optimization --enable-soap --enable-ftp --enable-sockets --enable-mbstring --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-libdir=lib64
make && make install && echo $?
cp php.ini-production /usr/local/php/etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
vi /usr/local/php/etc/php.ini
cgi.fix_pathinfo=0
cd /usr/local/php/etc/
cp php-fpm.conf.default php-fpm.conf
vi php-fpm.conf
pid = run/php-fpm.pid
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500

chkconfig php-fpm on
chmod +x /etc/init.d/php-fpm
service php-fpm start

3. Install nginx
yum -y install pcre-devel
cd nginx-1.0.2
vi auto/cc/gcc
#CFLAGS="$CFLAGS -g"
vi src/core/nginx.h
#define NGINX_VER          "nginx"
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install && echo $?
ln -s /usr/local/nginx/sbin/nginx /usr/sbin/
vi /usr/local/nginx/conf/nginx.conf
user  www www;
worker_processes  8;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    tcp_nopush     on;
    keepalive_timeout  65;
    gzip  on;
    server {
        listen       80;
        server_name  localhost;
        location / {
            root   html;
            index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            include        fastcgi.conf;
        }
    location /status {
        stub_status on;
        access_log off;
    }
    location /phpmyadmin {
        root html;
        index index.php;
    }
    }
}
nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
nginx
cd /usr/local/nginx/html/
tar xf /root/phpMyAdmin-3.4.2-all-languages.tar.bz2
mv phpMyAdmin-3.4.2-all-languages/ phpmyadmin
cd phpmyadmin/
cp config.sample.inc.php config.inc.php
vi config.inc.php
$cfg['blowfish_secret'] = 'w'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
open firefox and test
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章