nginx-ssl
Nginx https 证书自己生成(debian系系统为例)
1.切换到/etc/nginx 目录下执行
1 | sudo openssl req -new -x509 -nodes -out server.crt -keyout server.key |
2.配置站点nginx(/etc/nginx/sites-enabled/test)
1 | upstream php5.6-fpm { |
3.重启nginx服务
1 | sudo systemctl restart nginx |
docker使用小技巧
大批量文件删除操作
百万级文件删除使用rm删除会十分缓慢,大量删除操作需要用到rsync同步命令。
例如需要删除文件夹/home/dyl/test/
- 首先新建一个空文件夹
/tmp/test/
。 - 然后使用以下命令删除 如果不想看到日志,参数换成
1
rsync --delete-before -a -H -v /tmp/test/ /home/dyl/test/
-d
.1
rsync --delete-before -d /tmp/test/ /home/dyl/test/
ssh 配置不同key对应不同的git仓库
需求
我们有很多仓库账号,每个仓库的登录用户又不同,这个时候就需要使用多个ssh keys配置不同的仓库,否则将会出现权限问题
步骤
1.首先生成ssh key
,参见生成ssk key.
2.配置config
(~/.ssh/config)
1 | Host git.us.magento.cloud |
如果都是使用github,建议别名项目仓库Host避免冲突,例如
git@michaeldyl520.github.com:xxxx/xxxx.git
apache使用php-fpm配置多版本
需求
有时候我们需要在同一台服务器配置多个php版本利于开发测试,我们可以直接使用他人做好的包直接安装配置,以deepin
示例。
步骤
首先加入多版本php源
1
2
3
4sudo apt-get -y install apt-transport-https lsb-release ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
sudo apt-get update安装
apache
和多版本php-fpm
1
sudo apt-get install apache2 php5.6-fpm php7.0-fpm php7.1-fpm
打开apache
headers
和proxy_fcgi
模块1
sudo a2enmod headers proxy_fcgi
apache
和php-fpm
建议运行用户配置成当前登录账号,避免出现权限问题配置虚拟域名
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16<VirtualHost *:80>
ServerName m1.mycoolcell.local
ServerAlias m1.mycoolcell.local
ServerAdmin webmaster@localhost
DocumentRoot /home/dyl/website/mycoolcell_m1
SetEnv MAGE_RUN_CODE wholesale
SetEnv MAGE_RUN_TYPE website
<FilesMatch "\.php$">
<If "-f %{REQUEST_FILENAME}">
SetHandler "proxy:unix:/run/php/php5.6-fpm.sock|fcgi://localhost/"
</If>
</FilesMatch>
ErrorLog ${APACHE_LOG_DIR}/m1.mycoolcell.local.error.log
CustomLog ${APACHE_LOG_DIR}/m1.mycoolcell.local.access.log combined
</VirtualHost>如果需要其他版本,将上面的
php5.6-fpm.sock
配置成php7.1-fpm.sock
即可。
elasticsearch-tips
Tips
1 | #show elasticsearch database |
本地开发减少docker elasticsearch的内存占用
1 | docker cp elasticsearch7177:/usr/share/elasticsearch/config/jvm.options ~/ |
magento2使用PayPal Payflow测试账号
访问开发文档搜索并点击
Create a test-only Payflow Gateway account
,继续点击Payflow Services
开始创建账号,根据需要的类型选择支付处理公司,除了邮件其他随意填继续下一步到结束。完成后会有成功注册信息发送到邮箱。根据邮件登录信息登录登录paypal payflow后台,
- 点击
Service Setting->Set Up->Payment Confirmation
中,修改Show confirmation pagew为On my website
,修改Return URL Method
为Post
。转到Security Options
,修改Enable Secure Token
为Yes
,保存; - 导航到
Service Setting->Customize->Choose a layout and color
,选择Layout C
,然后保存发布(Save and Publish); - 导航到
Account Administration->Manage Security->Transaction Settings
,修改Allow reference transactions
为Yes
,保存(Confirm
);
- magento2后台配置paypal payflow后即可使用测试信用卡测试。
关于magento-cloud新项目无法pull代码的问题
问题
magento-cloud新项目添加magento-cloud ssh-key:add后仍然无法pull代码,
处理
解决方法如下:
1.需要配置~/.ssh/config
文件,例如:
gedit ~/.ssh/config
,
拷贝以下到~/.ssh/config
中
1 | Host git.us-3.magento.cloud |
2.获取公钥写入到~/.ssh/known_hosts
中,终端执行以下命令:
1 | ssh-keyscan -H git.us-3.magento.cloud >> ~/.ssh/known_hosts |