1在walle服务器中:
当web服务器是lamp的时候,查看apache的进程用户,就是查看的此环境下php进程用户,当web服务器是lnmp环境时,通过ps aux | grep php 即可查到
2查看php进程用户,我配置的是apache用户,su apache 的时候。如果不能登录,查看/etc/passwd里面apache用户末尾是不是sbin/nologin,是的话修改为/bin/bash,这个修改可以在所有配置完成后修改回来
3su apache
生成apache用户的密钥ssh-keygen -t rsa
此时可能会报错
enerating public/private rsa key pair.
Enter file in which to save the key (/usr/share/httpd/.ssh/id_rsa):
Could not create directory '/usr/share/httpd/.ssh': Permission denied
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Saving key "/usr/share/httpd/.ssh/id_rsa" failed: No such file or directory
解决办法:
查看到apache用户的家目录是/usr/share/httpd
su root
然后mkdir -p /usr/share/httpd/.ssh
chmod 777 /usr/share/httpd/.ssh/ -R
然后继续su apache
ssh-keygen-t rsa 就可以生成密钥
Generating public/private rsa key pair.
Enter file in which to save the key (/usr/share/httpd/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /usr/share/httpd/.ssh/id_rsa.
Your public key has been saved in /usr/share/httpd/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:peeNzoMvXOP9wZeHCpN8rD3xVEhGCxAlidBIJf6iKh4 apache@walle.jason.com
The key's randomart image is:
+---[RSA 2048]----+
| .+=..+=o.. |
| ...o .. .o. |
| . . o.. |
| . o . .|
| . S . . |
| . . +o=.....|
| E . . +Bo+++.o|
|. .. +oo*o..o.|
|.o. o=.oo. |
+----[SHA256]-----+
注意:如果github是私有项目:则先su apache 再ssh-keygen -t rsa -C +github账号引号里面是github账号。而且项目地址要用git地址
然后:
查看apache用户的密钥:
将apache用户的密钥放入对应github仓库的Deploy keys中(进入github仓库,settings->Deploy keys->add Deploy keys)
ssh-copy-id -i /root/.ssh/id_rsa.pub root@ip
ssh root@ip测试能不能免密钥登陆
cat /usr/share/httpd/.ssh/id_rsa.pub
ssh-copy-id -i /usr/share/httpd/.ssh/id_rsa.pub www@ip
此时ssh www@ip
还是需要输入密码才可以登录
解决办法:将walle服务器root用户的密钥放在web服务器中的/home/www/.ssh/authorized_keys里面,即,web服务器www用户根目录里面的密钥有两个
再次测试apahce用户免密钥登录,就可以了
然后:
mkdir /warehouse/
chown apache.apache /warehouse/
如果在上线的时候出现错误:
Host key verification failed. rsync: connection unexpectedly closed
解决办法
sudo -u apache HOME=/home/cronuser ssh www@ip
输入yes再次刷新界面即可
4关于日志不显示的问题
Mkdir /data/www/walle-web/log/
chmod 777 log/ -R
cd /data/www/walle-web/config/
修改vim params.php文件里面查找log.dir
修该之前的/tmp/walle为/data/www/walle-web/log/
此时在对应路径下会出现日志,查看即可