Skip to content

Instantly share code, notes, and snippets.

View amanjuman's full-sized avatar
😉
Ill

Aman Juman amanjuman

😉
Ill
View GitHub Profile
@amanjuman
amanjuman / OpenEMR Nginx Configuration
Created October 26, 2020 14:00
OpenEMR Nginx Configuration
server
{
# Listen
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name subdomain.domain.tld;
root /var/www/subdomain.domain.tld;
index index.html index.php;
@amanjuman
amanjuman / default
Last active August 16, 2024 20:57
Nginx Default Config Deny All Trafic
# wget -q https://gist.githubusercontent.com/amanjuman/8ad9e374cb970a352d08b950e3d3dbef/raw/ddf53d463c80dfe76f7594b3bb3a58df63cd2aad/default -O /etc/nginx/sites-available/default
server
{
server_name "";
listen 80 default_server;
listen [::]:80 default_server;
#listen 443 ssl http2 default_server;
#listen [::]:443 ssl http2 default_server;
# Generate Self-Signed-SSL
@amanjuman
amanjuman / default
Created December 10, 2020 08:52
AWS ELB/ALB Health Bypass for Nginx
server
{
listen 80 default_server;
listen [::]:80 default_server;
server_name "";
location /health
{
access_log off;
@amanjuman
amanjuman / phpmyadmin.conf
Created December 10, 2020 09:24
PHPMyAdmin Nginx Configuration
server
{
# Port Listen
listen 80;
listen [::]:80;
#listen 443 ssl http2;
#listen [::]:443 ssl http2;
# Root Dir
root /usr/share/phpmyadmin;
@amanjuman
amanjuman / PHPMyAdmin For AWS RDS
Last active August 14, 2021 10:33
PHPMyAdmin For AWS RDS
sudo apt install nginx-full mysql-client apache2-utils php7.4-{apcu,bcmath,bz2,curl,fpm,intl,json,gd,mbstring,mysql,xml,zip} phpmyadmin -y
or
sudo wget https://files.phpmyadmin.net/phpMyAdmin/5.1.1/phpMyAdmin-5.1.1-english.zip && sudo unzip phpMyAdmin-5.1.1-english.zip
mv phpMyAdmin-5.1.1-english phpmyadmin
mv phpmyadmin /usr/share/
sudo htpasswd -c /etc/nginx/.htpasswd username
wget -q https://gist.githubusercontent.com/amanjuman/595ba5ec6494a03e8b0544986cafb092/raw/2c078604ac65ee4aee2f58b89f3239817c89e2d3/phpmyadmin.conf -O /etc/nginx/conf.d/phpmyadmin.conf
sudo chown -R www-data:www-data /usr/share/phpmyadmin/
@amanjuman
amanjuman / Openlitespeed Complete Server Setup
Created January 3, 2021 08:11
Openlitespeed Complete Server Setup
hostnamectl set-hostname hostname.domain.tld
sudo add-apt-repository ppa:ondrej/php -y && sudo add-apt-repository ppa:certbot/certbot -y && wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | sudo bash
sudo apt-get update && sudo apt-get -y upgrade && sudo apt dist-upgrade -y && sudo apt-get autoremove -y
sudo apt install ufw openlitespeed certbot lsphp74 lsphp74-common lsphp74-dev lsphp74-curl lsphp74-imap lsphp74-mysql lsphp74-intl lsphp74-json lsphp74-opcache lsphp74-imagick lsphp74-memcached lsphp74-redis lsphp74-pgsql lsphp74-sqlite3 lsphp74-tidy lsphp74-snmp lsphp74-dbg mysql-server -y
sudo ufw allow 22,53,80,443,7080,8088/tcp
sudo ufw default reject
sudo ufw enable
#!/bin/bash
#1) on https://console.developers.google.com/ register project, enable Groups Migration API, and create OAuth2 credentials.
#2) set the client_id and client_secret variables below to the values provided when creating the OAuth2 credentials.
#3) make copies of the Client ID and Client Secret for the OAuth2 credentials and use them
client_id="..."
client_secret="...."
#4) get authorization code at the following link using web browser
# (make sure you sign in with an account that has access to Google Groups you are importing to).
@amanjuman
amanjuman / Disable systemd-resolved in Ubuntu 18.04 x64
Created May 19, 2021 13:53
Disable systemd-resolved in Ubuntu 18.04 x64
sudo systemctl disable systemd-resolved
sudo systemctl stop systemd-resolved
sudo nano /etc/systemd/resolved.conf
DNSStubListener=no
rm /etc/resolv.conf
@amanjuman
amanjuman / PHPMyadmin Apache2 Subdomain Config
Created June 25, 2021 12:09
PHPMyadmin Apache2 Subdomain Config
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName sql.domain.tld
DocumentRoot /usr/share/phpmyadmin
RewriteEngine on
RewriteCond %{SERVER_NAME} =sql.domain.tld
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
@amanjuman
amanjuman / ssh-harden
Created August 13, 2021 13:48
SSH Hardening
## Remove Existing Host Files
rm /etc/ssh/ssh_host_*
## Regenerate Host Files
ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_key -N ""
ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N ""
## Enable Host Files
sed -i 's/^HostKey \/etc\/ssh\/ssh_host_\(dsa\|ecdsa\)_key$/\#HostKey \/etc\/ssh\/ssh_host_\1_key/g' /etc/ssh/sshd_config