linux+php+mysql+nginx 测试环境搭建步骤:
tar zxvf xxx.tar.gz
cd xxx
./configure
make &&
make install
cd ..
上面这5步“常规”步骤如无特殊情况将默认忽略
安装前先确认没有安装内建的rpm包('rpm -qa | grep xxx'
[mysql、php、nginx]),如果有最好使用rpm -e xxx卸载。
安装mysql:
groupadd mysql
useradd -g mysql mysql
wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.54.tar.gz/from/http://mysql.ntu.edu.tw/
./configure --prefix=/usr/local/mysql/ --sysconfdir=/etc
--localstatedir=/var/lib/mysql --with-extra-charsets=complex
--with-big-tables --enable-local-infile
/usr/local/mysql/bin/mysql_install_db --user=mysql
--basedir=/usr/local/mysql --datadir=/var/lib/mysql
cp support-files/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysqld_safe &
/usr/local/mysql/bin/mysql -uroot
set password for root@localhost
=password('123456');
exit
安装php以及一些可能的依赖包(依不同环境而不同):
(php5.3.3起自带php-fpm包,参见http://php-fpm.org/)
php:
wget http://cn2.php.net/get/php-5.3.5.tar.gz/from/cn.php.net/mirror
./configure --prefix=/usr/local/php
--with-config-file-path=/usr/local/php/etc --enable-mbstring
--with-mysql=/usr/local/mysql
--with-mysqli=/usr/local/mysql/bin/mysql_config --with-zlib
--with-gd --with-jpeg-dir --with-libxml-dir --with-png-dir
--with-freetype-dir --with-iconv-dir=/usr/local/libiconv
--enable-ftp --with-curl --enable-sockets --enable-bcmath
--enable-shmop --with-openssl --with-mhash --with-xmlrpc
--enable-zip --enable-soap --enable-fpm
cp php.ini-development /usr/local/php/etc/php.ini
cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf
vi php-fpm.conf
去掉pm.start_servers pm.min_spare_servers
pm.max_spare_servers这三个字段前面的分号注释符
然后启动php-fpm:
/usr/local/php/sbin/php-fpm
安装nginx以及可能的依赖包(依不同环境而不同):
nginx:
groupadd www
useradd -g www www
wget http://nginx.org/download/nginx-0.9.3.tar.gz
./configure --user=www --group=www --prefix=/usr/local/nginx
--with-http_stub_status_module --with-http_ssl_module
vi /usr/local/nginx/conf/nginx.conf
修改:
[root@localhost conf]# diff nginx.conf nginx.conf.default
2c2
< user www www;
---
> #user nobody;
5c5
< error_log logs/error.log;
---
> #error_log logs/error.log;
9c9
<
pid logs/nginx.pid;
---
>
#pid logs/nginx.pid;
65,72c65,71
---
> #location ~ \.php$ {
> # root html;
> # fastcgi_pass 127.0.0.1:9000;
> # fastcgi_index index.php;
> # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
> # include fastcgi_params;
> #}
启动nginx:
/usr/local/nginx/sbin/nginx
附带:
检查配置文件:
/usr/local/nginx/sbin/nginx -t
重载配置文件:
/usr/local/nginx/sbin/nginx -s
reload
参考: