centos1.7 配置nginx+php+mysql客户端+thinkphp的rewrite实现
1 . 安装php7
下载地址:https://secure.php.net/downloads.php
这里下载的是:wget http://ar2.php.net/distributions/php-7.0.6.tar.gz
下载之后解压并进入在解压文件中
安装:./configure -enable-fpm --with-pdo-mysql --with-mysql --with-mysqli --with-curl --with-openssl --enable-mbstring(enable-fpm参数即可开启PHP-FPM) -> make && make install
(PHP在 5.3.3 之后已经讲php-fpm写入php源码核心了)
2 . nginx整合php-fpm
. 启动php-fpm: /usr/local/sbin/php-fpm
报错
[18-May-2016 18:07:58] ERROR: failed to open configuration file '/usr/local/etc/php-fpm.conf': No such file or directory (2)
[18-May-2016 18:07:58] ERROR: failed to load configuration file '/usr/local/etc/php-fpm.conf'
[18-May-2016 18:07:58] ERROR: FPM initialization failed
到/usr/local/etc/目录下,将php-fpm.conf.default拷贝一份成php-fpm.conf
3 . 安装nginx
Nginx 一般有两个版本,分别是稳定版和开发版,您可以根据您的目的来选择这两个版本的其中一个,下面是把 Nginx 安装到 /usr/local目录下的详细步骤:
wget http://nginx.org/download/nginx-1.4.2.tar.gz
tar -zxvf nginx-1.4.2.tar.gz
cd nginx-1.4.2
./configure
make
make install
4 THINK3.2.3 的配置
修改nginx的配置文件
#user nobody;
worker_processes ; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections ;
} http {
include mime.types;
default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on;
#tcp_nopush on; #keepalive_timeout ;
keepalive_timeout ; #gzip on; server {
listen ;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / {
root html;
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$ last;
break;
}
} error_page /.html;
location = /.html {
return 'Sorry, File not Found!';
}
# redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:
# location ~ \.php/?.*$ {
root html;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
include fastcgi_params;
set $fastcgi_script_name2 $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+\.php)(/.+)$") {
set $fastcgi_script_name2 $;
set $path_info $;
}
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name2;
fastcgi_param SCRIPT_NAME $fastcgi_script_name2;
} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen ;
# listen somename:;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#} }
centos1.7 配置nginx+php+mysql客户端+thinkphp的rewrite实现的更多相关文章
- [原创]Centos7 从零配置Nginx+PHP+MySql
序言 这次玩次狠得.除了编译器使用yum安装,其他全部手动编译.哼~ 看似就Nginx.PHP.MySql三个东东,但是它们太尼玛依赖别人了. 没办法,想用它们就得老老实实给它们提供想要的东西. 首先 ...
- windows7配置Nginx+php+mysql教程
windows7配置Nginx+php+mysql教程 最近在学习php,想把自己的学习经历记录下来,并写一些经验,仅供参考交流.此文适合那些刚刚接触php,想要学习并想要自己搭建Nginx+php+ ...
- windows7配置Nginx+php+mysql的详细教程
windows7配置Nginx+php+mysql的详细教程 作者:Vincent.李 字体:[增加 减小] 类型:转载 时间:2016-09-04我要评论 这篇文章主要介绍了windows7配置Ng ...
- virtualBox安装centos7并配置nginx php mysql运行环境
virtualBox安装centos7并配置nginx php mysql运行环境 一:virtualBox安装centos7并进行基础设置 1.下载dvd.iso安装文件,下载地址:https:// ...
- nginx + php +mysql (适配thinkphp)
Nginx 单机配置 http://tengine.taobao.org/book/index.html (taobao book) http://ubuntuhandbook.org/index.p ...
- docker完整配置nginx+php+mysql
首先了解一个方法: 使用docker exec进入Docker容器 docker在1.3.X版本之后还提供了一个新的命令exec用于进入容器,这种方式相对更简单一些,下面我们来看一下该命令的使用: s ...
- Cubieboard A10 安装Nand系统,配置nginx,php,mysql,samba详细教程
安装前置条件 1.下载win32diskimager-v0.7-binary.zip 2.下载debian_wheezy_armhf_v1_mele.zip 3.下载cubie_nand_uboot_ ...
- 在ubuntu上配置nginx+php+mysql+phpmyadmin
1.先更新ubuntu系统 更新命令 sudo apt-get update sudo apt-get upgrade 2 添加ubuntu nginx更新源镜像 cd /etc/apt/ sudo ...
- CentOS6.3上安装与配置nginx+php+mysql环境
1. 目前nginx采用是源码包安装的方式(yum安装失败),下载地址:http://nginx.org/en/download.html 我这里的安装包是:nginx-1.12.0.tar.gz 2 ...
随机推荐
- ReentrantReadWriteLock——写写互斥(二)
"读写" ."写读"."写写"都是同步的.互斥的 1.Service.java package ReentrantReadWriteLock ...
- L220
He must not allow this unusual barrier (obstacle) to stop him from fighting against the enemy.他绝不能让这 ...
- css 兼容 各类手机的写法 待续
@media (device-height:480px) and (-webkit-min-device-pixel-ratio:2){/* 兼容iphone4/4s */ .class{} } @m ...
- pdo 数据库链接
在PHP中,我们还可以使用一种更为简单直接的数据库连接方案——PDO持久化连接. 关于PDO本身,这里就不再多作介绍了,大家可以参考之前的文章<使用PDO连接多种数据库>以及PHP官方网站 ...
- Code Sign error: Provisioning profile XXXX can't be found
[iphone]Code Sign error: Provisioning profile XXXX can't be found 如果你更新了profile,再编译iphone项目,发现下面的错误, ...
- Python 文件路径
# 文件路径: # 1. 相对路径: 相对于当前程序所在的文件夹, 如果在文件夹内, 随便找, 直接写名字 # 如果不在这个文件夹内, 可能需要出文件夹或者进文件夹 # 出文件夹 ../ # 进文件夹 ...
- Python API快餐教程(1) - 字符串查找API
字符串处理相关API 字符串是7种序列类型中的一种. 除了序列的操作函数,比如len()来求字符串长度之外,Python还为字符串提供丰富到可以写个编辑器的API. 查找类API 首先,下面的查找AP ...
- 【转载】Java Web的web.xml文件作用及基本配置
其实web.xml就是asp.net的web.config一个道理. 说明: 一个web中完全可以没有web.xml文件,也就是说,web.xml文件并不是web工程必须的. web.xml文件是用来 ...
- tensorflow中的参数初始化方法
1. 初始化为常量 tf中使用tf.constant_initializer(value)类生成一个初始值为常量value的tensor对象. constant_initializer类的构造函数定义 ...
- node+mongoose使用例子
https://github.com/Aquarius1993/nodeNotes 功能 1. 注册 2. 登录 3. 修改密码 4. 修改头像 5. 获取用户笔记 6. 添加,删除,更新笔记 安装部 ...