一、CentOS 5.5 操作系统的安装
操作系统这里我们仍采用 CentOS 5.5 来说明 Linux 下的 Nginx 安装与配置。关于CentOS的安装与注意事项请大家点击这里:(其中包含配置yum的步骤,因为我们接下来会使用到yum)。
二、准备工作
和Apache的配置相同,我们就来进行一些准备工作,譬如创建网站目录,日志目录等。然后安装服务器的相关软件。
(1) 创建网站目录和日志目录
shell> mkdir -p /www/mysql # MySQL数据库文件
shell> mkdir -p /www/htdocs # 网站主目录
shell> mkdir -p /var/log/php # PHP日志目录
shell> mkdir -p /var/log/mysql # MySQL日志目录
(2) 改变MySQL属主和用户组
shell> chown -R mysql:mysql /www/mysql
shell> chown -R mysql:mysql /var/log/mysql
(3) 改变网站目录属主和用户组
shell> chown -R www:www /www/htdocs
shell> chown -R www:www /var/log/php
注:如果 mysql 等用户不存在,则需要事先通过 useradd 指令创建。这里我们创建的 www 用户和用户组,用于 Nginx 守护进程。
shell> useradd -s /sbin/nologin -M mysql
1. yum安装MySQL
# 安装系统组件,这些大都是一些编译环境、PHP扩展等等,如果这些都使用源代码安装,那是一个痛苦的过程。
shell> yum -y install gcc gcc-c++ autoconf make
shell> yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel openldap-clients openldap-servers
shell> yum -y install mysql mysql-devel mysql-server
在安装过程中,我们看到使用了上述我们的非官方源进行更新,通过这种方式安装的软件版本分别为: MySQL 5.1.50 ( 截止到2010-09-16)
2. MySQL 的启动与基本配置
系统已经安装好了 MySQL 数据库,我们来稍作配置后然后启动它,因为初次启动会安装数据库文件,所以要对my.cnf里的配置进行一些修改,尤其是数据库文件存放位置。
# 复制一个样本,/usr/share/mysql 目录下有好多样本,请自主选择。
shell> cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
修改配置文件,我们稍作修改
# 注:是在原有my.cnf基础上进行修改,没有的选项添加
shell> vi /etc/my.cnf
[client]
port = 3306
socket = /var/lib/mysql/mysql.sock
default-character-set = utf8
[mysqld]
user = mysql
datadir = /www/mysql
log-error = /var/log/mysql/mysql_error.log
log-bin=/var/log/mysql/mysql-bin
character-set-server = utf8
启动 MySQL,或者使用 service mysqld start ,系统会提示安装数据库,然后启动成功。否则请查看由 log-error 配置项定义的错误信息。
shell> /etc/init.d/mysqld start
MySQL 初始安装启动后是可以用匿名空密码登陆的,我们需要删除匿名用户,更改root账户密码
shell> mysql
mysql> UPDATE mysql.user SET password = PASSWORD('cmstop') WHERE user = 'root';
mysql> DELETE FROM mysql.user WHERE user = '';
mysql> FLUSH PRIVILEGES;
# 查看MySQL 支持插件情况 注:这种方式安装的MySQL 默认支持 InnoDB, 查看该值后面是否为 YES
mysql> SHOW VARIABLES LIKE '%have%';
# 查看MySQL 字符集,应该都是 utf8
mysql> SHOW VARIABLES LIKE '%char%';
3. 安装Nginx
接下来我们采用源代码的方式安装Nginx + PHP ,首先下载程序所需源码包:
shell> cd ~
(感谢张宴为大家提供的源码包镜像,原文出处:http://blog.s135.com/nginx_php_v6/)
wget http://blog.s135.com/soft/linux/nginx_php/nginx/nginx-0.8.46.tar.gz
wget http://blog.s135.com/soft/linux/nginx_php/php/php-5.2.14.tar.gz
wget http://blog.s135.com/soft/linux/nginx_php/phpfpm/php-5.2.14-fpm-0.5.14.diff.gz
wget http://blog.s135.com/soft/linux/nginx_php/libiconv/libiconv-1.13.1.tar.gz
wget http://blog.s135.com/soft/linux/nginx_php/mcrypt/libmcrypt-2.5.8.tar.gz
wget http://blog.s135.com/soft/linux/nginx_php/mcrypt/mcrypt-2.6.8.tar.gz
wget http://blog.s135.com/soft/linux/nginx_php/mhash/mhash-0.9.9.9.tar.gz
wget http://blog.s135.com/soft/linux/nginx_php/pcre/pcre-8.10.tar.gz
wget http://blog.s135.com/soft/linux/nginx_php/pdo/PDO_MYSQL-1.0.2.tgz
(1) 安装 Nginx 所需的pcre库
shell> tar zxvf pcre-8.10.tar.gz
shell> cd pcre-8.10/
shell> ./configure --enable-utf8 --enable-pcregrep-libz --enable-pcregrep-libbz2 --enable-unicode-properties
shell> make && make install
shell> cd ..
(2) 安装 Nginx
shell> tar zxvf nginx-0.8.46.tar.gz
shell> cd nginx-0.8.46
shell> ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
shell> make && make install
shell> cd ..
# 做个Nginx 的指令软链接,方便我们启动,停止
shell> ln -s /usr/local/nginx/sbin/nginx /usr/sbin/nginx
# Nginx 的启动,停止,平滑重启指令。仅限0.8.*系列
shell> nginx -s {reload | start | stop}
Nginx 0.8.46我们已经安装好了,直接启动,在浏览器中输入服务器IP。看到了这样的界面是不是有点兴奋了?
4. 安装PHP
(1) 安装 libiconv
shell> cd ~
shell> tar zxvf libiconv-1.13.1.tar.gz
shell> cd libiconv-1.13.1/
shell> ./configure --prefix=/usr/local
shell> make && make install
shell> cd ..
(2) 安装 PHP
shell> tar zxvf php-5.2.14.tar.gz
shell> gzip -cd php-5.2.14-fpm-0.5.14.diff.gz | patch -d php-5.2.14 -p1
shell> cd php-5.2.14/
shell> ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql --with-mysqli --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-gd --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap
shell> make ZEND_EXTRA_LIBS='-liconv'
( 注:这里可能会报错。报未找到 liconv ,.so 库等等。按照下面几种方法解决,再重新 make install:
I. error while loading shared libraries: libiconv.so.2 .....
shell> vi /etc/ld.so.conf 在文件最后加入 /usr/local/lib 這一行
shell> ldconfig -v
II. 64位操作系统,还可能会报 liconv 路径不对,尝试以下方法,
shell> ln -s /usr/local/lib/libiconv.so.2 /usr/local/lib64/libiconv.so.2
shell> ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/libiconv.so.2 )
shell> make install
shell> cp php.ini-dist /usr/local/php/etc/php.ini
shell> cd ..
(3) 安装 PDO_mysql 扩展
shell> tar zxvf PDO_MYSQL-1.0.2.tgz
shell> cd PDO_MYSQL-1.0.2/
shell> /usr/local/php/bin/phpize
shell> ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql
shell> make && make install
shell> cd ..
(4) 安装 ZendOptimizer 扩展
下载相应 Zend Optimizer 扩展,分别对应32位和64位:
shell> wget http://download.cmstop.com/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
shell> wget http://download.cmstop.com/ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
shell> tar xvzf ZendOptimizer-3.3.9...
shell> cp ZendOptimizer-3.3.9.../data/5_2_x_comp/ZendOptimizer.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613
(5) 修改 php.ini 配置文件
shell> vi /usr/local/php/etc/php.ini
查找 extension_dir = "./"
修改为 extension_dir = "/usr/local//php/lib/php/extensions/no-debug-non-zts-20060613/"
查找 cgi.fix_pathinfo=0
以下配置参考修改:
short_open_tag = On
output_buffering = 4096
max_execution_time = 600
post_max_size = 32M
allow_url_fopen = On
open_basedir = /www/htdocs/
upload_max_filesize = 32M
log_errors = On
error_reporting = E_ALL & ~E_NOTICE | E_STRICT
display_errors = Off
error_log = /var/log/php/php_error.log
magic_quotes_gpc = Off
最后在该文件最后增加以下配置段:
extension = "pdo_mysql.so"
[Zend]
zend_extension="/usr/local//php/lib/php/extensions/no-debug-non-zts-20060613/ZendOptimizer.so"
zend_optimizer.enable_loader = 1
zend_optimizer.optimization_level=0
zend_optimizer.disable_licensing=0
这样,我们的PHP以及相关扩展都已经安装完毕了,接下来我们说明Nginx 如何与 PHP 进行 CGI交互。
三、配置 Nginx 与 PHP (FastCGI)
1. 创建php-fpm配置文件
(php-fpm是为PHP打的一个FastCGI管理补丁,可以平滑变更php.ini配置而无需重启php-cgi)
shell> cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
shell> vi /usr/local/php/etc/php-fpm.conf
这是一个xml的配置文件,以下用红色标注注意修改的地方,其他则为默认文件配置:
pid_file /usr/local/php/logs/php-fpm.pid
error_log /usr/local/php/logs/php-fpm.log
log_level notice
daemonize yes
listen_address 127.0.0.1:9000
display_errors 0
user www
group www
max_children 32
启动php-cgi进程,监听127.0.0.1的9000端口,进程数为32(进程数自行修改,视服务器配置和 Nginx 进程数而定),用户为www:
shell> ulimit -SHn 65535
shell> /usr/local/php/sbin/php-fpm start
# 我们也创建个 PHP 的软链接,方便控制
shell> ln -s /usr/local/php/sbin/php-fpm /usr/sbin/php-fpm
PHP 进程的启动,停止,平滑重启方法:
shell> php-fpm {start | stop | quit | restart | reload | logrotate}
2. 修改 Nginx 配置文件
修改 Nginx 前,我们先将服务停止,执行:
shell> nginx -s stop
Nginx 有和Apache 同样的配置文件检测指令,所以在每次修改配置文件后,请检测下语法是否有错误:
shell> nginx -t
以下是配置范例,请参考修改红色部分:
user www www;
worker_processes 4;
error_log /var/log/nginx_error.log crit;
pid /usr/local/nginx/nginx.pid;
worker_rlimit_nofile 65535;
events
{
use epoll;
worker_connections 65535;
}
http
{
include mime.types;
default_type application/octet-stream;
charset utf8;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
ssi on;
ssi_silent_errors off;
ssi_types text/shtml;
server
{
listen 80;
server_name localhost;
index index.shtml index.html index.php;
root /www/htdocs;
location ~ .*\.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 7d;
}
access_log off;
}
}
以上配置文件启动了4个Nginx进程,指定用户名为 www ,并且配置了默认的虚拟主机 localhost,指向/www/htdocs目录,这个只是方便我们测试用。
3. 启动Nginx + PHP
shell> ulimit -SHn 65535
shell> php-fpm restart
shell> nginx
创建phpinfo.php文件测试:
shell> vi /www/htdocs/phpinfo.php
浏览器访问我们的phpinfo.php,看到如此熟悉的身影,这说明我们的PHP CGI 已经安装成功,顺便查看是否包含 Zend 等扩展:
注:因为我们配置了localhost虚拟主机段,这里是通过主机IP访问,如http://192.168.1.190/phpinfo.php
编辑Nginx的配置文件
shell> vi /usr/local/nginx/conf/nginx.conf
在http语句段中加入以下几行:
ssi on;
ssi_silent_errors off;
ssi_types text/shtml;
重启Nginx服务即可。
1. 配置虚拟主机
你不会想安装在 localhost 通过 IP 地址来访问吧,肯定不想,那我们就简要来说下 Nginx 下的虚拟主机配置:
编辑配置文件,增加一段 server 配置段。(提示:你也可以像Apache一样,写个 include vhosts/*.conf 语句)
shell> vi /usr/local/nginx/conf/nginx.conf # 增加一段server
server
{
listen 80;
server_name www.demo.loc;
index index.shtml index.html index.php;
root /www/htdocs/demo;
location ~ .*\.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 7d;
}
access_log off;
}
创建网站目录:
shell> mkdir /www/htdocs/demo
2. 上传 CmsTop 大众版程序文件
上传CmsTop大众版至安装目录/www/htdocs/demo目录下,然后我们更改一下网站目录的属主和属组。
shell> chown -R www:www /www/htdocs/demo
进入安装界面第二步,查看环境监测配置,如果您是通过 Windows 环境下绑定 hosts 文件访问,会发现 SSI 没有检测成功,这是因为我们配置的 www.demo.loc 域名并没有通过合法的 DNS 进行解析,修改 Linux 主机的 hosts 文件可以解决。
shell> vi /etc/hosts
127.0.0.1 www.demo.loc # 增加此行
按照环境要求设置相应的目录权限,因为我们刚才已经将整个目录设为 www 权限,所以只需要更改 /index.php 这个文件的权限即可:
shell> chmod 777 /www/htdocs/demo/index.php
恭喜您,您的环境已经完全符合 CmsTop 大众的安装需求!
4. 创建 MySQL 数据库
shell> mysql -uroot -p
mysql> create database demo; # 创建 demo 数据库( 注:为什么没指定字符集,因为我们已经在配置文件默认设置设置为 utf8 了)
mysql> GRANT ALL PRIVILEGES ON demo.* TO 'demo'@'localhost' IDENTIFIED BY 'cmstop'; # 创建 demo 数据库的账户
mysql> FLUSH PRIVILEGES;
然后在安装界面的第三步中,填写刚刚创建的数据库信息,测试成功。下一步下一步……
5. CmsTop 大众版安装完毕
安装完成后进入后台: http://www.demo.loc/admin
依次进行以下操作:
工具 -- 文件校验
工具 -- 更新缓存
内容 -- 快捷操作 -- 生成首页、生成栏目页、生成内容页
区块 -- 全部生成
然后预览下我们的前台页面:http://www.demo.loc
Nginx+MySQL+PHP+phpmyadmin+memcache+eaccelerator For CentOS Linux
至于为什么要搭建这个平台,我大概就不用多说了,能找到这里来的肯定对Nginx有一定了解。不多说了,直入主题:
本人建议使用CentOS(yum太方便了),其他版本不能通过yum更新的请自行下载下面的包。本人在CentOS 5.2和CentOS 4.7 Server版本中测试均无任何错误,单机30分钟安装完成!
为了方便大家,下面整个过程并不复杂,你只需复制黏贴即可,无需打任何命令!
一,首先升级更新系统各种库(基本完整)
yum -y install patch make gcc gcc-c++ autoconf kernel-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel
yum -y install fonts-chinese scim-chewing scim-pinyin scim-tables-chinese
二,下载所需软件:
wget http://leoz.googlecode.com/files/nginx-0.7.19.tar.gz
wget http://leoz.googlecode.com/files/php-5.2.6.tar.gz
wget http://leoz.googlecode.com/files/php-5.2.6-fpm-0.5.9.diff.gz
wget http://leoz.googlecode.com/files/libiconv-1.12.tar.gz
wget http://leoz.googlecode.com/files/libmcrypt-2.5.8.tar.gz
wget http://leoz.googlecode.com/files/mcrypt-2.6.7.tar.gz
wget http://leoz.googlecode.com/files/memcache-2.2.3.tgz
wget http://leoz.googlecode.com/files/mhash-0.9.9.tar.gz
wget http://leoz.googlecode.com/files/pcre-7.7.tar.gz
wget http://leoz.googlecode.com/files/eaccelerator-0.9.5.3.tar.bz2
wget http://leoz.googlecode.com/files/mysql-5.0.22.tar.gz
wget http://leoz.googlecode.com/files/phpMyAdmin-3.1.1-all-languages.tar.gz
三,安装PHP环境支持包(就是上面的包)
tar zxvf libiconv-1.12.tar.gz
cd libiconv-1.12/
./configure --prefix=/usr/local
make
make install
cd ../
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd http://www.cnblogs.com/
tar zxvf mhash-0.9.9.tar.gz
cd mhash-0.9.9/
./configure
make
make install
cd ../
cp /usr/local/lib/libmcrypt.* /usr/lib
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
tar zxvf mcrypt-2.6.7.tar.gz
cd mcrypt-2.6.7/
./configure
make
make install
cd ../
四,安装Mysql
tar -zxvf mysql-5.0.22.tar.gz
cd mysql-5.0.22
./configure --prefix=/usr/local/webserver/mysql --enable-assembler --with-charset=utf8 --enable-thread-safe-client --with-extra-charsets=all --without-innodb --without-isam
make;make install
cd ../
groupadd mysql
useradd -g mysql mysql
cp /usr/local/webserver/mysql/share/mysql/my-medium.cnf /etc/my.cnf
/usr/local/webserver/mysql/bin/mysql_install_db --user=mysql
chown -R mysql /usr/local/webserver/mysql/var
chgrp -R mysql /usr/local/webserver/mysql/.
cp /usr/local/webserver/mysql/share/mysql/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
chkconfig --level 345 mysql on
echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
echo "/usr/local/lib" >>/etc/ld.so.conf
ldconfig
ln -s /usr/local/webserver/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/webserver/mysql/include/mysql /usr/include/mysql
service mysql start
/usr/local/mysql/bin/mysqladmin -u root password root
service mysql restart
service mysql stop
五,安装PHP
tar zxvf php-5.2.8.tar.gz
gzip -cd php-5.2.8-fpm-0.5.10.diff.gz | patch -d php-5.2.8 -p1
cd php-5.2.8/
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets
make ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-dist /usr/local/php/etc/php.ini
cd ../
make
make install
cp php.ini-dist /usr/local/php/etc/php.ini
cd ../
六,安装配置eaccelerator+memcache
tar zxvf memcache-2.2.3.tgz
cd memcache-2.2.3/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
cd ../
tar jxvf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3/
/usr/local/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config
make
make install
cd ../
sed -i 's#extension_dir = "./"#extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"\nextension = "memcache.so"\n#' /usr/local/php/etc/php.ini
sed -i 's#output_buffering = Off#output_buffering = On#' /usr/local/php/etc/php.ini
mkdir -p /usr/local/eaccelerator_cache
cat >>/usr/local/php/etc/php.ini<<EOF
[eaccelerator]
zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="1"
eaccelerator.cache_dir="/usr/local/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="3600"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
eaccelerator.keys = "disk_only"
eaccelerator.sessions = "disk_only"
eaccelerator.content = "disk_only"
#[eaccelerator]
#zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
#eaccelerator.shm_size="128"
#eaccelerator.cache_dir="/usr/local/eaccelerator_cache"
#eaccelerator.enable="1"
#eaccelerator.optimizer="1"
#eaccelerator.check_mtime="1"
#eaccelerator.debug="0"
#eaccelerator.filter=""
#eaccelerator.shm_max="0"
#eaccelerator.shm_ttl="300"
#eaccelerator.shm_prune_period="120"
#eaccelerator.shm_only="0"
#eaccelerator.compress="1"
#eaccelerator.compress_level="9"
七,创建www用户和用户组,
groupadd www
useradd -g www www
mkdir -p /web/www
chmod +w /web/www
mkdir -p /web/logs
chmod 777 /web/logs
chown -R www:www /web/www
rm -f /usr/local/php/etc/php-fpm.conf
cp conf/php-fpm.conf /usr/local/php/etc/php-fpm.conf
echo "ulimit -SHn 51200" >/root/run.sh
echo "/usr/local/php/sbin/php-fpm start" >>/root/run.sh
八,安装Nginx
tar zxvf pcre-7.7.tar.gz
cd pcre-7.7/
./configure
make && make install
cd ../
tar zxvf nginx-0.7.19.tar.gz
cd nginx-0.7.19/
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
cd ../
rm -f /usr/local/nginx/conf/nginx.conf
cp conf/nginx.conf /usr/local/nginx/conf/nginx.conf
sed -i 's/www.xxxx.com/'$domain'/g' /usr/local/nginx/conf/nginx.conf
rm -f /usr/local/nginx/conf/fcgi.conf
cp conf/fcgi.conf /usr/local/nginx/conf/fcgi.conf
echo "/usr/local/nginx/sbin/nginx" >>/root/run.sh
chmod 777 /root/run.sh
service mysql start
/root/run.sh
九,安装phpmyadmin
tar zxvf phpMyAdmin-3.1.1-all-languages.tar.gz
mv phpMyAdmin-3.1.1-all-languages /web/www/phpmyadmin
十,加入开机自启动
echo "ulimit -SHn 51200" >>/etc/rc.local
echo "/usr/local/php/sbin/php-fpm start" >>/etc/rc.local
echo "/usr/local/nginx/sbin/nginx" >>/etc/rc.local
大功告成!还有什么不懂,留言或直接BadiHi ! ^ _ ^
(欢迎纠正错误!)