Skip to content

Instantly share code, notes, and snippets.

@negamist
negamist / mysql-docker.sh
Created January 9, 2023 11:24 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@negamist
negamist / nginx-tuning.md
Created June 24, 2022 14:03 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@negamist
negamist / UFW_ban_country.md
Created May 17, 2022 07:35 — forked from jasonruyle/UFW_ban_country.md
UFW to block countries
@negamist
negamist / html-template.html
Created December 7, 2021 16:49
A Sample HTML Template for better SEO
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<meta name='viewport' content="width=device-width,height=device-height, initial-scale=1, shrink-to-fit=yes">
<!--theme colors -->
<meta name="theme-color" content="" />
@negamist
negamist / cdn-nginx.conf
Created September 7, 2021 13:49 — forked from saosangmo/cdn-nginx.conf
Nginx CDN Server Configuration
server {
listen 80;
server_name cdn.domain.org;
root /usr/share/nginx/cdn
location / {
proxy_pass http://domain.org;
proxy_set_header Host $host;
proxy_set_header True-Client-IP $remote_addr;
@negamist
negamist / cdn-nginx.conf
Created September 7, 2021 13:49 — forked from alsyundawy/cdn-nginx.conf
Nginx CDN Server Configuration
server {
listen 80;
server_name cdn.domain.org;
root /usr/share/nginx/cdn
location / {
proxy_pass http://domain.org;
proxy_set_header Host $host;
proxy_set_header True-Client-IP $remote_addr;
@negamist
negamist / gist:a77b5fda5a9b9c7c89d827a294204a88
Created September 1, 2021 10:29 — forked from timperrett/gist:e6079101ae469822a9b2c8c1a46429aa
Increate max no of open files limit in Ubuntu 16.04 for Nginx
# maximum capability of system
user@ubuntu:~$ cat /proc/sys/fs/file-max
708444
# available limit
user@ubuntu:~$ ulimit -n
1024
# To increase the available limit to say 200000
user@ubuntu:~$ sudo vim /etc/sysctl.conf
@negamist
negamist / Instructions.sh
Created December 30, 2020 05:17 — forked from GhazanfarMir/Instructions.sh
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa