狗狗佳缘最烂的空间

不积硅步无以至千里 不积小流无以成江海
http://www.jcan.19dog.com/

查看文章

(原创) Debian + Nginx + PHP + Mysql 的安装

2009/06/26 10:05 P.M.

今天折腾了一下新的架构: Debian, Nginx, PHP, MySQL的组合

便于以后升级,全部采用源码方式安装

 

1.  安装MySQL

unzip mysql-5.1.35.zip
cd mysql-5.1.35

groupadd mysql
useradd -g mysql mysql

./configure --prefix=/usr/local/mysql-5.1
make & make install

cp support-files/my-medium.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
ln -s /etc/init.d/mysqld /etc/rc3.d/S99mysql
ln -s /etc/init.d/mysqld /etc/rc0.d/K01.mysql

cd /usr/local/mysql
chown -R mysql:mysql .
bin/mysql_install_db --user=mysql --defaults-file=/etc/my.cnf
chown -R root .
chown -R mysql var

/etc/init.d/mysqld start (或者 bin/mysqld_safe --user=mysql &)

 

2. 安装PHP

./configure --prefix=/usr/local/php-5.3 \
--with-openssl \
--enable-bcmath \
--enable-safe-mode \
--with-curl \
--with-gd \
--enable-mbstring \
--with-mysql=/usr/local/mysql-5.1 \
--with-mysql-sock=/tmp/mysql.sock \
--with-mysqli=/usr/local/mysql-5.1/bin/mysql_config \
--with-pdo-mysql=/usr/local/mysql-5.1 \
--with-tidy \
--with-config-file-path=/etc

 make & make install

 cp php.ini-development /etc/php.ini

 

3. 安装Nginx

./configure --prefix=/usr/local/nginx-0.8 \
--with-http_ssl_module \
--with-mail \
--with-debug

make & make install

 

使其支持PHP:

vim /etc/local/nginx-0.8/conf/nginx.cnf

        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

 

* 启动Nginx: sbin/nginx

* 重启Nginx: kill -HUP `cat /usr/local/nginx-0.8/logs/nginx.pid`

* 停止Nginx: killall nginx

 

4. 安装spawn-fcgi 

监听PHP:

spawn-fcgi -a 127.0.0.1 -p 9000 -C 5 -u www -g www -f /usr/local/php-5.3/bin/php-cgi

关闭监听:

killall spawn-fcgi

 

5. Welcome to nginx! 

 

转自 jcan.ouk.cn

OH, YEAH!

 

 

网友评论

暂无评论

发表评论

姓 名:
网址/邮箱:
(选填)
内 容:
验证码:
导航