werfdsf 发表于 2015-8-27 09:33:27

lnmp环境搭建

php 2.4mysql 5.5nignx 1.4.7   一、安装mysqlyum installgcc-c++ cmake ncurses-devel bison perl -y
useradd-s/sbin/nologinmysql
mkdir-p/data/mysql
chown-Rmysql.mysql/data/mysql
tar -zxvf mysql-5.5.44.tar.gz;cd mysql-5.5.44
cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DMYSQL_DATADIR=/data/mysql -DWITH_MYISAM_STORAGE_ENGINE=1      -DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_READLINE=1 -DMYSQL_TCP_PORT=3306       -DENABLED_LOCAL_INFILE=1
-DWITH_PARTITION_STORAGE_ENGINE=1-DEXTRA_CHARSETS=all-DDEFAULT_CHARSET=utf8       -DDEFAULT_COLLATION=utf8_general_ci
-DWITH_DEBUG=0 -DMYSQL_USER=mysql -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock       make -j2 && make install
                        
cpsupport-files/my-medium.cnf   /etc/my.cnf
cp support-files/mysql.server/etc/init.d/mysqld
chmod755/etc/init.d/mysqld
/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/data/mysql--user=mysql
/etc/init.d/mysqldstart
chkconfig --add mysqld
echo "PATH=$PATH:/usr/local/mysql/bin">>/etc/profile
source/etc/profile

   二、安装php
cd   php-5.4
yuminstall-y libxml2-devellibcurl-developenjpeg-devellibjpeg-turbo-devel libpng-develfreetype-devel
./configure--prefix=/usr/local/php--enable-fpm--enable-debug --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir--enable-mbstring --with-curl --with-mysql=/usr/local/mysql
make   &&makeinstall
cp sapi/fpm/php-fpm/etc/init.d/php-fpm
cd/usr/local/php/etc/&&cp php-fpm.conf.defaultphp-fpm.conf
/etc/init.d/php-fpm   ##启动php-fpm


      三、安装nginx
下载nginxwgethttp://nginx.org/download/nginx-1.4.7.tar.gztar –zxvf nginx-1.4.7.tar.gzcd nginx-1.4.7yum installpcre-devel-y 安装pcre库,支持rewrite 重写注:安装源码的pcre时,指定pcre路径为解压的路径,而不是编译后的路径,否则会报错yum install-y openssl-develuseradd -s /sbin/nologing   -Mwww./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_modulemake&&makeinstall       四、nginx整合php编辑nginx配置文件 nginx.conf,在server 字段里加入:location ~ \.php$ {         root         html;         fastcgi_pass   127.0.0.1:9000;         fastcgi_indexindex.php;         fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;         include      fastcgi_params;      }
将改为:

页: [1]
查看完整版本: lnmp环境搭建