Skip to content

Instantly share code, notes, and snippets.

@angelflo
angelflo / magento.vcl
Created October 8, 2021 15:35 — forked from dvershinin/magento.vcl
Magento 2 VCL file for Varnish 4.x: supports multiple stores better, allows purging arbitrary URLs https://www.getpagespeed.com/web-apps/magento/varnish-vcl-magento-2
vcl 4.0;
import std;
# The minimal Varnish version is 4.0
# For SSL offloading, pass the following header in your proxy server or load balancer: 'X-Forwarded-Proto: https'
backend default {
.host = "localhost";
.port = "8080";
.first_byte_timeout = 600s;
@angelflo
angelflo / .gitignore
Created February 4, 2020 16:04 — forked from karmi/.gitignore
Example Nginx configurations for Elasticsearch (https://www.elastic.co/blog/playing-http-tricks-nginx)
nginx/
!nginx/.gitkeep
!nginx/logs/.gitkeep
src/
tmp/
@angelflo
angelflo / my.cnf
Created February 2, 2020 07:41 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaSQL (on Ubuntu, CentOS etc. servers)
# Optimized my.cnf configuration for MySQL/MariaSQL
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated January 2020 ~
#
#
# The settings provided below are a starting point for a 2GB - 4GB RAM server with 2-4 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@angelflo
angelflo / gist:b01a5070e54a2789b6e01dd8d64a03ce
Created December 26, 2019 15:47 — forked from luckydev/gist:b2a6ebe793aeacf50ff15331fb3b519d
Increate max no of open files limit in Ubuntu 16.04/18.04 for Nginx
# maximum capability of system
user@ubuntu:~$ cat /proc/sys/fs/file-max
708444
# available limit
user@ubuntu:~$ ulimit -n
1024
# To increase the available limit to say 200000
user@ubuntu:~$ sudo vim /etc/sysctl.conf
@angelflo
angelflo / gist:44ff6d266909e86618046c0d9f9538fd
Created December 5, 2019 06:26 — forked from paugnu/gist:1eb7045d660ebe61e51987554e3a1450
Owebia configuration for product shipping restriction
{
"envio_AD": {
"label": "Andorra",
"description": "Envío normal Andorra",
"shipto": "AD",
"conditions": "{skus_es_only.conditions} && {cart.free_shipping}!='true'",
"fees": "{table {cart.weight} in 5.0100:5.5100,10.0100:5.5100,15.0100:6.9200,20.0100:8.0000,25.0100:10.4500,30.0100:11.3400,35.0100:11.3400,40.0100:11.3400,45.0100:11.3800,50.0100:12.4100,60.0100:13.4400,70.0100:15.5000,80.0100:17.5700,90.0100:19.3000,100.0100:21.0200,110.0100:22.7500,120.0100:27.0700,130.0100:27.0700,140.0100:31.3900,150.0100:31.3900,160.0100:35.7100,170.0100:35.7100,180.0100:39.0800,190.0100:39.0800,10000.0000:39.0800}"
},
"envio_EU1": {
"label": "Países: AT, BG, CH, CY, CZ, DK, EE, FI, GR, HU, IE, IS, IT, LI, LT, LU, LV, MC, MT, NO, PL, RO, SK, SI, SE",
@angelflo
angelflo / Robots.txt
Created October 27, 2019 16:10 — forked from rafaelstz/Robots.txt
Robots.txt Magento 2
# Directories & files
Disallow: /wishlist/
Disallow: /customer/
Disallow: /checkout/
Disallow: /catalog/
Disallow: /catalogsearch/
Disallow: /downloader/
Disallow: /braintree/
Disallow: /order/
Disallow: /rma/
@angelflo
angelflo / Firewalld GeoIP firewall script
Created July 15, 2019 14:26 — forked from Pandry/Firewalld GeoIP firewall script
Block countries IPs via Firewalld
#!/bin/bash
##
# Name: GeoIP Firewall script
# Author: Pandry
# Version: 0.1
# Description: This is a simple script that will set up a GeoIP firewall blocking all the zones excecpt the specified ones
# it is possible to add the whitelisted zones @ line 47
# Additional notes: Usage of [iprange](https://github.com/firehol/iprange) is suggested
# for best performances
@angelflo
angelflo / cloud-sql-proxy.service
Created June 11, 2019 03:08 — forked from goodwill/cloud-sql-proxy.service
Example Systemd file for starting cloud sql proxy at system start
[Install]
WantedBy=multi-user.target
[Unit]
Description=Google Cloud Compute Engine SQL Proxy
Requires=networking.service
After=networking.service
[Service]
Type=simple
@angelflo
angelflo / restart-service.sh
Created June 1, 2019 04:37 — forked from fer-ri/restart-service.sh
Auto Restart PHP5-FPM When Down or Bad Gateway
#!/bin/bash
if curl --head -sf http://yourdomain.com/some-script.php -o /dev/null; then
echo "PHP FPM is up"
else
service php5-fpm restart && service nginx restart && service mysql restart
echo "Opps .. service was down" | mail -s "PHP-FPM Service Down" yourmail@domain.com -aFrom:cron@yourmail.com
fi
@angelflo
angelflo / letsencrypt_2018.md
Created December 14, 2018 07:25 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files: