尝试用Nginx软件建站

Nginx是一款性能与稳定性均超越Apache的Web服务器、反向代理服务器,同时也可作IMAP/POP3/SMTP 代理服务器。两星期前依照 Nginx 0.8.x + PHP 5.2.13(FastCGI)搭建胜过Apache十倍的Web服务器(第6版)[原创] 尝试在Linux机上架设服务器,过程很是坎坷,自己也排除了几个错误,现就把安装笔记不做修改地发出来,共同学习。

教程就是上面那个链接:http://blog.s135.com/nginx_php_v6/ ,很长就不转了;下面是我个人的排错笔记。 

 

1、④、创建管理MySQL数据库的shell脚本:
vi /data0/mysql/3306/mysql

在这个文件中,function_kill_mysql() 函数用到了管线符号 '|'
但是,复制之后,显示的字符是 '$#124;'   其实应该为 '|',替换后即正常。
===============================
2、⑦、通过命令行登录管理MySQL服务器(提示输入密码时直接回车):
/usr/local/webserver/mysql/bin/mysql -u root -p -S /tmp/mysql.sock

上网搜索 sql无法启动 ,大致原因是 一个链接文件 不存在(或还没有刷新)产生的,详见:
http://www.blogjava.net/asenyifei/articles/82575.html
后来自己好了
===============================
3、4、编译安装PHP5扩展模块
tar zxvf ImageMagick.tar.gz
cd ImageMagick-6.5.1-2/
./configure
make
make install
cd ../

make 这一步错误,从网上下载新版本的 ImageMagick ,make 正常
另外,这一步一定要早于 imagick-2.3.0.tgz 进行安装,一般来说,程序员给出的说明,还是要按照顺序进行的。
===============================
4、9、启动php-cgi进程,监听127.0.0.1的9000端口,进程数为128(如果服务器内存小于3GB,可以只开启64个进程),用户为www:
ulimit -SHn 65535
/usr/local/webserver/php/sbin/php-fpm start

照做后,提示错误:
Starting php_fpm eAccelerator: Could not allocate 67108864 bytes, the maximum size the kernel allows is 33554432 bytes. Lower the amount of memory request or increase the limit in /proc/sys/kernel/shmmax.
网上查得,php.ini中设置的eAccelerator(可使用的共享内存大小)如下:eaccelerator.shm_size="64",也即64M,而在Linux下,单个进程的最大内存使用量受/proc/sys/kernel/shmmax中设置的数字限制(单位为字节)  /proc/sys/kernel/shmmax = 33554432 (32M)
临时更改该值:
echo 128000000 > /proc/sys/kernel/shmmax
或者
vi /etc/sysctl.conf
kernel.shmmax = 128000000
syscatl -p
===============================
继续尝试启动,仍有错误:
Starting php_fpm /usr/local/webserver/php/etc/php-fpm.conf:156: parser error : XML declaration allowed only at the start of the document                        
</configuration><?xml version="1.0" ?>                                          
                     ^                                                          
/usr/local/webserver/php/etc/php-fpm.conf:157: parser error : Extra content at the end of the document                                                          
<configuration>                                                                 
^                                                                               
Oct 01 01:39:30.486908 [ERROR] fpm_conf_init_main(), line 517: failed to load configuration file: failed to parse conf file                                     
 failed
说我配置文件有误,我就cat这个文件,读了一遍发现有两个</configuration>。。后来看明白了,我把配置写了两遍。。更改,便启动成功了。这个是个人失误,我在修改完conf文具后还cat确认过。。
小心小心。。
===============================

 

posted @ 2011-10-11 20:20  王晗  阅读(534)  评论(0编辑  收藏  举报