码迷,mamicode.com
首页 > Web开发 > 详细

thinkphp nginx+phpcgj安装配置

时间:2016-08-22 15:01:06      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:

环境:mysql-5.6.26             nginx-1.9.4.tar.gz   php-5.6.13

程序框架ThinkPHP 

客户要求必须使用nginx + php

1.首先安装nginx ,mysql ,php

2.安装扩展php扩展:pdo_mysql

1 cd /usr/local/src/php-5.6.13/ext/pdo_mysql/
2 /usr/local/php/bin/phpize   # /usr/local/php为php安装后的目录
3 ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
4 sudo make && sudo make install

3.修改php.ini文件

sudo vi /usr/local/php/lib/php.ini

增加以下内容: 

extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-x x x x/"
extension = pdo_mysql.so

4.修改php.ini文件

 php.ini(/usr/local/php/etc/php.ini)的配置中中找到

  cgi.fix_pathinfo=0

  将其改成

  cgi.fix_pathinfo=1

5.在nginx/conf/vhosts/目录下创建一个配置文件,并在nginx.conf中引用

 1 server {
 2     listen       80;
 3     server_name  127.0.0.1;
 4     location / {
 5         root   /html/htdocs_xxx/;
 6         index  index.htm index.html index.php;
 7         if (!-e $request_filename) {
 8            rewrite  ^/(.*)$  /index.php/$1  last;
 9            break;
10         }
11     }
12     location ~ \.php/?.*$ {
13         root       /html/htdocs_xxx/;
14         fastcgi_pass   127.0.0.1:9000;
15         fastcgi_index  index.php;
16         include        fastcgi.conf;
17 
18         set $fastcgi_script_name2 $fastcgi_script_name;
19         if ($fastcgi_script_name ~ "^(.+\.php)(/.+)$") {
20             set $fastcgi_script_name2 $1;
21             set $path_info $2;
22         }
23         fastcgi_param   PATH_INFO $path_info;
24         fastcgi_param   SCRIPT_FILENAME   $document_root$fastcgi_script_name2;
25         fastcgi_param   SCRIPT_NAME   $fastcgi_script_name2;
26     }
27 }

 



thinkphp nginx+phpcgj安装配置

标签:

原文地址:http://www.cnblogs.com/zhming26/p/5795578.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!