1、安装composer(如果没有安装过)
curl -sS https://getcomposer.org/installer | phpmv composer.phar /usr/local/bin/composer
要检查 Composer 是否正常工作,只需要通过 php 来执行 PHAR:
php composer.phar
文档:
http://www.kancloud.cn/manual/thinkphp5/118006
http://www.kancloud.cn/thinkphp/composer/35669
2、由于访问国外项目比较慢,修改composer镜像为国内
composer config -g repo.packagist composer https://packagist.phpcomposer.com
文档:http://pkg.phpcomposer.com/
3、确保安装成功后切换到web服务器存放站点的目录,我这里是/www/wwwroot
4、安装thinkphp5
composer create-project topthink/think tp5(这个是你站点的目录文件名称,我这里用的是www.tp5.vm)
等待下载完成后,配置好apache或者nginx,然后修改host即可访问
5、查看thinkphp的版本
[root@localhost thinkphp]# pwd
/www/wwwroot/www.tp5.vm/thinkphp
[root@localhost thinkphp]# cat base.php
下面的5.0.2即是thinkphp的版本
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
define('THINK_VERSION', '5.0.2');
6、配置文件
我这里的是在:
website dir:/www/wwwroot/www.tp5.vm
----------------------------------------
conf file:/www/lanmps/nginx/conf/vhost/www.tp5.vm.conf
----------------------------------------
access_log:/www/wwwLogs/www.tp5.vm.log
修改配置(nginx):
站点根目录为/www/wwwroot/www.tp5.vm/public,下面第二个加粗的是开启rewrite
[root@localhost vhost]# cat www.tp5.vm.conf
server
{
listen 80;
server_name www.tp5.vm ;
root /www/wwwroot/www.tp5.vm/public;
location / {
index index.html index.htm index.php default.html default.htm default.php;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*.(js|css)?$ {
expires 12h;
}
location ~ .php$ {
#fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass bakend;
fastcgi_index index.php;
include fastcgi.conf;
}
include /www/wwwroot/www.tp5.vm/lanmps-*.conf;
#log_format www.tp5.vm '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $http_x_forwarded_for';
access_log /www/wwwLogs/www.tp5.vm.log access;
}
7、重启nginx,访问站点域名或ip即可
- 相关文章
- phpexcel设置行高及列宽,背景颜色,
- 单点登录sso原理及php实现方式及de
- 在php中用curl请求java接口无法获
- 免费ip地址查询接口
- php,java,android, aes加解密-加密
- 地图上计算两点间的距离
- 关于百度地图的一些技巧
- php中empty,is_null,isset的区别
- windows及linux下composer安装教程
- 一种精妙的数据查询与存储方式
- 热门文章
- win7中将文件拷贝到虚拟机linux下
- phpexcel设置行高及列宽,背景颜色,
- rabbitmq无法启动
- intellij idea不显示git push按钮
- php7中使用mongodb的aggregate进行
- laravel页面静态化的方法
- centos7.4 64位下swoole安装及配置
- navicate连接mycat报1184错误
- curl设置超时不起作用(CURLOPT_TIM
- devops-jenkins容器为pending状态
- 好评文章
- phpexcel设置行高及列宽,背景颜色,
- php7中使用mongodb的aggregate进行
- intellij idea打开文件所在文件夹
- windows下使用MongoDB Compass Com
- win7中将文件拷贝到虚拟机linux下
- laravel 中悲观锁 & 乐观锁的使用
- 单点登录sso原理及php实现方式及de
- navicate连接mycat报1184错误
- rabbitmq无法启动
- laravel整合dingo/api方法步骤:jwt
- 我的项目
- 【github】www.github.com/hurong241
- 【码云】gitee.com/hu_rong/projects
- 【docker hub】hub.docker.com/repositories/hurong241
- 【packagist】packagist.org/users/hurong241/packages
- 站点信息
- 建站时间:2011年
- 文章数:623篇
- 浏览数:1306209