LNMP服务器架设(RHEL5.5)(4)

(2)配置Nginx支持PHP解析,使用第二种方法

[root@localhost etc]# vi /usr/local/nginx/conf/nginx.conf

      server {

              listen       80;

              server_name ;

     

              charset utf-8;

     

              access_log logs/host.access.log main;

     

              location / {

                  root   /var/www/benet;

                  index index.html index.php;

              }

              location ~ \.php$ {

              root    /var/www/benet;

              fastcgi_pass    127.0.0.1:9000;

              fastcgi_index   index.php;

              include         fastcgi.conf;

      }

      }

      server {

              listen       80;

              server_name ;

     

              charset utf-8;

     

              access_log logs/host.access.log main;

     

              location / {

                  root   /var/www/accp;

                  index index.html index.php;

             }

              location ~ \.php$ {

              root    /var/www/accp;

              fastcgi_pass    127.0.0.1:9000;

              fastcgi_index   index.php;

              include         fastcgi.conf;

      }

              location ~ /status {

              stub_status     on;

              access_log      off;

      }

 

             error_page   500 502 503 504 /50x.html;

             location = /50x.html {

                 root   html;

             }

      }

      }

(3)php页面测试

[root@localhost etc]# vi /var/www/benet/test.php

<?php

$link=MySQL_connect('localhost','root','');

if($link) echo "<h1>succell!!</h1>";

mysql_close();

?>

在LEMP平台中部署WEB应用

(1)       下载并部署程序代码

[root@localhost ~]# tar zxf SKYUC_3.2.2_Free_For_PHP5.3.tar.bz2

[root@localhost ~]# mv SKYUC_3.2.2_Free_For_PHP5.3/wwwroot /var/www/benet/skyuc/

[root@localhost ~]# cd /var/www/benet/skyuc/

[root@localhost skyuc]# chown -R nginx.nginx admincp/ data/ templates/ upload/

(2)创建数据库

[root@localhost ~]# mysql

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 29

Server version: 5.1.55-log Source distribution

 

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

This software comes with ABSOLUTELY NO WARRANTY. This is free software,

and you are welcome to modify and Redistribute it under the GPL v2 license

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql> create database skyucdb;

mysql> grant all on skyucdb.* to runskyuc@localhost identified by '123';

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/c30741d0f9305ba5279674a60cf9bb81.html