Skip to content

Instantly share code, notes, and snippets.

@iamdylanngo
iamdylanngo / setup-magento-cache.txt
Last active April 29, 2020 14:53
setup-magento-cache.txt
docker run --name redis -p 6379:6379 -d redis
bin/magento setup:config:set --page-cache=redis --page-cache-redis-server=127.0.0.1 --page-cache-redis-db=1
docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:tag
@iamdylanngo
iamdylanngo / varnish-log.txt
Created April 20, 2020 08:15
varnish-log.txt
# filter by request host header
varnishlog -q 'ReqHeader ~ "Host: example.com"'
# filter by request url
varnishlog -q 'ReqURL ~ "^/some/path/"'
# filter by client ip (behind reverse proxy)
varnishlog -q 'ReqHeader ~ "X-Real-IP: .*123.123.123.123"'
# filter by request host header and show request url and referrer header
@iamdylanngo
iamdylanngo / nginx-apache-varnish-cache.txt
Created April 19, 2020 16:59
nginx-apache-varnish-cache.txt
1, Config varnish cache
Example varnish cache config:
vim /etc/varnish/default.vcl
vcl 4.0;
# Default backend definition. Set this to point to your content server.
backend default {
@iamdylanngo
iamdylanngo / apache-with-varnish-cache.txt
Created April 19, 2020 15:19
apache-with-varnish-cache.txt
1, Config varnish cache
Example varnish cache config:
vim /etc/varnish/default.vcl
vcl 4.0;
# Default backend definition. Set this to point to your content server.
backend default {
@iamdylanngo
iamdylanngo / auto-backup.txt
Created April 9, 2020 18:17
auto-backup.txt
https://www.urbackup.org/
@iamdylanngo
iamdylanngo / php-session.txt
Created April 7, 2020 11:09
php-session.txt
chown -R nginx:nginx /var/lib/php/session
service php-fpm restart
service nginx restart
https://flood.io/blog/load-testing-a-magento-e-commerce-shop
https://element.flood.io/docs/1.0/get-started
@iamdylanngo
iamdylanngo / magento2-deployer.txt
Created April 5, 2020 16:36
magento2-deployer.txt
<?php
namespace Deployer;
use Deployer\Task\Context;
use Symfony\Component\Console\Input\InputOption;
// TODO Add deployer version check (now it works only with Deployer >= 5.0)
const DEPLOY_ASSETS_TIMEOUT_OPTION_NAME = 'deploy-assets-timeout';
@iamdylanngo
iamdylanngo / config-reverse-proxy-nginx.txt
Created April 3, 2020 16:49
reverse-proxy-nginx.txt
https://medium.com/magebit/magento-2-full-ssl-with-varnish-d2cfed3d7df
https://easyengine.io/tutorials/nginx/forwarding-visitors-real-ip/
@iamdylanngo
iamdylanngo / ssl-nginx-centos7.txt
Created April 3, 2020 15:09
ssl-nginx-centos7.txt
mkdir -p /etc/ssl/private
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt