1. composer安装 apt install composer 。https://pkg.phpcomposer.com/,镜像速度快一点。
2. redis 安装 oneinstack中有具体的操作 。
cd /root/oneinstack,
./addons.sh #注:支持安装、卸载功能。
选择redis,install。
3. git
1) apt-get install git 安装
git
2) adduser git 创建一个
git
用户,用来运行git
服务
3) 收集所有需要登录的用户的公钥,就是他们自己的
id_rsa.pub
文件,把所有公钥导入到/home/git/.ssh/authorized_keys
文件里,一行一个。
4) 初始化Git仓库:cd home/git git init --bare purenfort.git
5) chown -R git:git purenfort.git 赋予权限
6) 禁用shell登录 出于安全考虑,第二步创建的git用户不允许登录shell,这可以通过编辑
/etc/passwd
文件完成。找到类似下面的一行:
git:x:1001:1001:,,,:/home/git:/bin/bash 改写成git:x:1001:1001:,,,:/home/git:/usr/bin/git-shell。
7)客户端 git clone git@server:/home/git/purenfort.git
8)后续就是一些提交代码的事情了。
9) web 目录同步 hooks里面cp一个post-receive文件,GIT_WORK_TREE=/XXXX/XXXX git checkout -f ,chmod +x post-receive 。web目录记得新建目录,赋予权限
4. tp5 nginx配置 这个配了很久,nginx.conf 调试了半天还是很有问题。最后在大神的帮助下解决了。当然看手册也很有用的。记得最重要的一点,display_errors一定要打开,这样可以看到报错。找到php.ini 修改 display_errors = On ,nginx.conf最后一句有增加了innclude vhost.*conf ,所以新建了文件夹vhost,创建了tp.conf。
server {
listen 80;
access_log /data/wwwlogs/tp_nginx.log combined;
index index.html index.htm index.php;
root /data/wwwroot/default/purenfort/public; #web目录
#error_page 404 /404.html;
#error_page 502 /502.html;
location / {
try_files $uri $uri/ /index.php?$query_string;#index.php路由重写
}
location ~ \.php(.*)$ { # 正则匹配.php后的pathinfo部分
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $1; # 把pathinfo部分赋给PATH_INFO变量
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires -1;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires -1;
access_log off;
}
location ~ /\.ht {
deny all;
}
}
我犯的错误:1.git下面有.gitignore,导致tp5加载不全;2.nginx.conf配置错误;3.tp5框架内部 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL', 'REQUEST_URI']。