nginx之 – 安装与配置

1、启用 EPEL repo

# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

2、安装nginx

yum -y install nginx

3、配置 PHP FastCGI

# yum install php-pear-Net-Socket php-pear php-common php-gd php-devel php php-mbstring php-pear-Mail php-cli php-imap php-snmp php-pdo php-xml php-pear-Auth-SASL php-ldap php-pear-Net-SMTP php-mysql

4、安装spawn-fcg

# yum install spawn-fcgi

5、安装 init.d shell使php以服务运行
下载zip后需要解压出sh文件,并赋予执行权限

# wget http://bash.cyberciti.biz/dl/419.sh.zip -O /etc/init.d/php_cgi.zip
# cd /etc/init.d/
# unzip php_cgi.zip
# mv 419.sh /etc/init.d/php
# chmod +x /etc/init.d/php

6、最基本配置

location ~ \.php$ {
            root           /var/www/html;
            fastcgi_pass   www.sgfblog.com:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /var/www/html$fastcgi_script_name;
            include        fastcgi_params;
        }

7、启动服务

# service php start
# service nginx start

当然也可以使用以下命令让服务自动启动哦

# chkconfig 服务名 on
发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>