Skip to content

Instantly share code, notes, and snippets.

View GhazanfarMir's full-sized avatar
😍
Code is LOVE

Ghazanfar Mir GhazanfarMir

😍
Code is LOVE
View GitHub Profile
@GhazanfarMir
GhazanfarMir / phpmyadmin.conf
Created June 8, 2016 19:22
PHPMyAdmin with NGINX
location /notphpmyadmin {
alias /usr/share/phpmyadmin;
location ~ \.php$ {
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php;
}
@GhazanfarMir
GhazanfarMir / configurations.conf
Last active April 29, 2017 19:25
CentOS 7, Nginx, WordPress & SSL Setup over Digital Ocean Droplet
# WordPress Configuration recommended by WordPress Community
# https://codex.wordpress.org/Nginx
# SSL is encrypted by Lets Encrypt
# https://letsencrypt.org/
# Additional help taken from tutorial
# https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-centos-7
# Description: You may skip steps you think are not relevant to you e.g I seek help from this tutorial
# to find location of the certificates and then tweaked configuration to what works in my situation.
@GhazanfarMir
GhazanfarMir / multilingual.txt
Created August 30, 2016 21:03
WordPress Multisites on Nginx + CentOS + MariaDB
// Multisites are installed via Sub Domains
// Root server_name should include main site as well as wildcard entry such as:
server_name example.com *.example.com
@GhazanfarMir
GhazanfarMir / httpd-vhosts.conf
Created August 31, 2016 15:21
MAMP Virtual Hosts
NameVirtualHost *:8888
<VirtualHost *:8888>
ServerName example.com
DocumentRoot /Applications/MAMP/htdocs/cato
<Directory /Applications/MAMP/htdocs/cato>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
@GhazanfarMir
GhazanfarMir / auth_basic.conf
Last active September 30, 2016 21:45
NGINX Implement Auth Basic
server {
listen 80;
server_name www.example.com
root /var/www/html/sites/example.com
## implementing Basic Authentication
auth_basic "Administrators Only Area"
auth_basic_user_file /etc/nginx/.htpasswd
@GhazanfarMir
GhazanfarMir / httpd-vhosts.conf
Last active October 1, 2016 22:43
Apache Virtual Hosts with Wildcards in case of Multi sites setup in sub domain
<VirtualHost *:80>
ServerAdmin info@demo.ghazanfarmir.local
DocumentRoot "/opt/lampp/htdocs/demo"
ServerName demo.ghazanfarmir.local
ServerAlias *.demo.ghazanfarmir.local # fr.demo.ghazanfarmir.local, de.demo.ghazanfarmir.local, ch.demo.ghazanfarmir.local
<Directory "/opt/lampp/htdocs/demo">
Options Indexes FollowSymLinks Includes execCGI
AllowOverride All
Require all granted
</Directory>
@GhazanfarMir
GhazanfarMir / .htaccess
Created October 7, 2016 17:26
Disable xmlrpc.php in WordPrrss
You can add this to your .htaccess:
# START XML RPC BLOCKING
<Files xmlrpc.php>
Order Deny,Allow
Deny from all
allow from 127.0.0.1
errordocument 401 default
errordocument 403 default
errordocument 404 default
@GhazanfarMir
GhazanfarMir / clear-images.sh
Last active January 21, 2024 19:27
Single shell script to remove all containers, images and volumes used by containers. The script first tries to stop containers if there is any running, then remove the containers, followed by images removal and finally the container volumes.
#!/bin/bash
###########################################
#
# Simple Shell script to clean/remove all container/images
#
# The script will
# - first stop all running containers (if any),
# - remove containers
# - remove images
# - remove volumes
@GhazanfarMir
GhazanfarMir / docker-compose.yaml
Created November 24, 2016 20:52
NGINX MySQL and PHP7
---
version: "2"
services:
dbserver:
image: mysql:latest
container_name: dbserver
environment:
- MYSQL_ROOT_PASSWORD=Pansymeer5
- MYSQL_DATABASE=gmir
- MYSQL_USER=gmir
@GhazanfarMir
GhazanfarMir / aliases
Created November 25, 2016 10:50
ZSH Aliases
-='cd -'
...=../..
....=../../..
.....=../../../..
......=../../../../..
1='cd -'
2='cd -2'
3='cd -3'
4='cd -4'
5='cd -5'