Skip to content

Instantly share code, notes, and snippets.

View julienbornstein's full-sized avatar

Julien Bornstein julienbornstein

View GitHub Profile
@twang2218
twang2218 / docker-compose.yml
Last active January 30, 2023 15:42
HAProxy + Nginx + PHP with client IP attached (don't forget docker daemon option `--userland-proxy=false`)
version: '2'
services:
haproxy:
image: haproxy:alpine
volumes:
- ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg
ports:
- "80:80"
depends_on:
- nginx
@tdsymonds
tdsymonds / mptt_m2m_admin.py
Created October 7, 2016 15:13
Improves the filter_horizontal widget for many to many admin relationship to model using django-mptt and django-parler.
# models.py
from mptt.models import MPTTModel, TreeForeignKey
from parler.models import TranslatableModel, TranslatedFields
from .managers import CategoryManager
class Category(MPTTModel, TranslatableModel):
parent = TreeForeignKey('self', null=True, blank=True, related_name='children', db_index=True)
@nrollr
nrollr / nginx.conf
Last active June 17, 2025 07:18
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
package auth
import (
"context"
"net/http"
"strings"
"google.golang.org/grpc/metadata"
"github.com/andela/micro-api-gateway/pb/authorization"
@CMCDragonkai
CMCDragonkai / environment_variables_for_php_applications.md
Last active January 4, 2023 19:36
Environment Variables for PHP Applications #php #configuration

Environment variables for PHP Applications

According to 12 factor app, the best way to configure things for deployment is through environment variables, not necessarily environment variable files, but just any environment variables. The problem is how to get environment variables into PHP. It is quite complicated depending on what you're doing.

The first step is to make sure you're using getenv in PHP for environment variables as the $_ENV array may not be set unless you set variables_order=EGPCS in the INI settings. This is enough for command line PHP applications including the command line PHP server.

If you're running PHP through Apache either via mod_php or CGI, the only way is to use an .htaccess file along the path from the index.php to the document root and to use SetEnv NAME Value directives. Or you put them into the Virtual Host block inside Apache configuration.

If you're using NGINX + PHP-FPM. You have 3 options:

@hoandang
hoandang / php-docker-ext
Created May 20, 2017 01:12
Complete list of php docker ext
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN docker-php-ext-install mcrypt
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
@sandeepsuvit
sandeepsuvit / flex-utils.scss
Created September 6, 2018 06:45
Flexbox utilities for bootstrap 3
/* -------------------------------------------------------------------------- */
// For bootstrap 3
.d-flex {
display: flex;
/* alignment */
&.flex-row {
flex-direction: row;
}
&.flex-row-reverse {