Skip to content

Instantly share code, notes, and snippets.

View hn-support's full-sized avatar

Hypernode Support hn-support

View GitHub Profile
@hn-support
hn-support / curl_speedtest.sh
Last active October 9, 2017 12:49
Test urls using curl
#!/bin/bash
# This script is a very basic curl utility to analyze urls.
# To use it, download the file, make it executable, and run:
# ./curl_speedtest.sh https://www.byte.nl
URL="$1"
if [ "x${URL}" == "x" ] || [[ ! "${URL}" =~ "http" ]] ; then
echo "Usage: $0 <url>"
exit 1
@hn-support
hn-support / block-version-control-on-apache2.md
Last active January 13, 2018 03:04
block version control directory on apache2
<Directorymatch "^/(.*/)*\.(git|svn)/">
  Order deny,allow
  Deny from all 
</Directorymatch>
@hn-support
hn-support / block-version-control-on-nginx.md
Last active January 13, 2018 03:05
block version control directory on nginx
# Skip .git, .htpasswd etc
location ~ /\.(git|svn|ht) {
    return 404;
}
@hn-support
hn-support / use-geoip-data-in.php
Last active January 14, 2019 08:38
How to use geoip data in php on hypernodes
<?php
/*
This script is a basic example of how to use GeoIP data in PHP.
It returns an overview of all available constants retrieved from the Maxmind GeoIP databases.
*/
$elements = array(
"country_code" => getenv('GEOIP_COUNTRY_CODE'),
"country_code3" => getenv('GEOIP_COUNTRY_CODE3'),
"country_name" => getenv('GEOIP_COUNTRY_NAME'),
@hn-support
hn-support / change_magento2_base_urls_to_https.py
Last active February 20, 2019 10:13
Change all base_urls of your Magento 2 live shop to https on hypernode
#!/usr/bin/env python
"""
Set the base-urls for your Magento 2 installation to support only https.
To use, download the file and make it executable. Then run:
./change_magento2_base_urls_to_https.py
After use, check your base-urls by issuing:
n98-magerun2 sys:store:config:base-url:list
This script requires n98-magerun2.
@hn-support
hn-support / Example snippet server.shopware
Last active February 22, 2019 09:02
Example Shopware Nginx rewrites
###General rewrites
location @shopware {
rewrite / /shopware.php;
}
# use shopware.php as index.php
location ~ ^/ {
# rewrite / /shopware.php;
index shopware.php index.php;
@hn-support
hn-support / robots.txt
Created March 30, 2017 12:00
Magento 2 recommended additions for robots.txt
User-agent: *
# Directories
Disallow: /app/
Disallow: /bin/
Disallow: /dev/
Disallow: /lib/
Disallow: /phpserver/
Disallow: /pkginfo/
Disallow: /report/
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 = "127.0.0.1";
.port = "8080";
}
@hn-support
hn-support / server.shopware
Last active January 28, 2020 15:11
Shopware Nginx configuration
## Author: Benjamin Cremer
## Shopware nginx rules.
## Heavily Inspired by https://github.com/perusio/drupal-with-nginx/
## Designed to be included in any server {} block.
## Please note that you need a PHP-FPM upstream configured in the http context, and its name set in the $fpm_upstream variable.
## https://github.com/bcremer/shopware-with-nginx
# don't log favicon hits
location = /favicon.ico {
log_not_found off;
#!/usr/bin/env python
""" Hypernode searchd cron watchdog
This script checks the pid of the searchd daemon and restarts it when the service is not running
It works for both Magento 1 and Magento 2 and for both live and staging.
To run it, add it to the crontab of your hypernode.
For Magento 1:
* * * * * flock -n ~/.searchd_live /data/web/searchd-watchdog.py --environment live --version 1 (live)