Skip to content

Instantly share code, notes, and snippets.

View nahidacm's full-sized avatar

Mahmudur Rahman nahidacm

  • Dhaka, Bangladesh
View GitHub Profile
@nahidacm
nahidacm / ubuntu-provision.sh
Last active June 5, 2023 10:44
Provisioning a base ubuntu docker image for production
apt update
# Install curl
apt install curl -y
# Install NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
source ~/.bashrc
# Install preffered one
nvm install --lts
server {
listen 80;
server_name epiclabs23.com;
access_log /var/log/nginx/epiclabs23.com.log;
error_log /var/log/nginx/epiclabs23.com.error.log;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
@nahidacm
nahidacm / docker-bash-alias
Last active October 19, 2022 04:29
Useful bash aliases
# for Ubuntu edit the file ~/.bash_aliases
# for Centos / Redhat edit the file ~/.bashrc
dex()
{
docker exec -it "$1" /bin/bash
}
alias dps='docker ps'
@nahidacm
nahidacm / apach-host.conf
Created January 20, 2021 10:01
Apache headers to avoid CORS
Header always set Access-Control-Allow-Origin "http://localhost:3000"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header always set Access-Control-Max-Age "1000"
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
Header always set Access-Control-Allow-Credentials true
sudo yum install epel-release -y
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum install yum-utils -y
sudo yum-config-manager --enable remi-php72 -y
sudo yum update -y
sudo yum install php72 -y
sudo yum install php72-php-bcmath php72-php-ctype php72-php-curl php72-php-dom php72-php-gd php72-php-hash php72-php-iconv php72-php-intl php72-php-mbstring php72-php-openssl php72-php-pdo_mysql php72-php-simplexml php72-php-soap php72-php-xsl php72-php-pecl-zip php72-php-pecl-redis php72-php-fpm php72-php-json php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-xmlrpc php72-php-opcache -y
sudo yum install httpd -y
sudo systemctl start httpd
sudo systemctl enable httpd
# VCL version 5.0 is not supported so it should be 4.0 even though actually used Varnish version is 5
vcl 4.0;
import std;
# The minimal Varnish version is 5.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";
#!/bin/bash
if [ "$1" == "extra" ]; then
start_msg="Starting napa extra"
else
start_msg="Starting napa"
fi
echo $start_msg
@nahidacm
nahidacm / phpmyadmin.conf
Created June 14, 2019 16:22
phpmyadmin nginx server block
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
@nahidacm
nahidacm / test.loc.conf
Created June 10, 2019 06:05
Ngix block file for laravel virtual host
server {
listen 80;
listen [::]:80;
root /var/www/test.loc;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name test.loc;
@nahidacm
nahidacm / magento2-nginx-server-block.conf
Last active April 17, 2019 03:21
Nginx server block configuration for magento 2
# Only one server block may have `upstream fastcgi_backend` block.
# So if you already defined that for some virtual host of your server do not ad that again for other hosts.
# In that case only `server` block is required.
upstream fastcgi_backend {
server unix:/run/php/php7.2-fpm.sock;
}
server {
listen 80;
listen [::]:80;