Skip to content

Instantly share code, notes, and snippets.

View nguyentienlong's full-sized avatar
💭
I may be slow to respond.

lk nguyentienlong

💭
I may be slow to respond.
  • Vietnam
View GitHub Profile
@nguyentienlong
nguyentienlong / x.blog.conf
Last active April 14, 2018 23:06
x.blog.conf
server {
root /home/example/stag/web;
server_name stag-web.example.vn www.stag-web.example.vn;
location /assets/ {
alias /home/example/stag/web/build/public/assets/;
add_header Cache-Control public;
}
location /blog {
@nguyentienlong
nguyentienlong / wp sub dir config
Created April 16, 2018 23:05
wordpress url rewrite for blog sub dir
rewrite ^/blog/wp-admin/$ /blog/wp-admin/options-general.php permanent;
rewrite ^/blog/(.*)/$ /blog/index.php?$1 last;
PYTHONPATH=. python test/test.py
@nguyentienlong
nguyentienlong / server tricks
Last active May 3, 2018 00:59
sudo without password
## sudo without pwd
```
longka ALL=(ALL) NOPASSWD: ALL
%sudo ALL=(ALL:ALL) NOPASSWD: ALL
```
--
## disable ssh with pass
@nguyentienlong
nguyentienlong / php7-with-fpm-custom-installation-dri
Last active June 13, 2018 21:13
install php7 with php-fpm on custom installation directory
# change directory to /opt
cd /opt
# tar source file
tar zxf php-7.0.3.tar.gz
# go to src dir
cd php-7.0.3
# build make file
# install php7 in /opt/php7 and specify the config file (php.ini) in /etc/php7
./configure --prefix=/opt/php7 \
--with-config-file-path=/etc/php7 \
@nguyentienlong
nguyentienlong / wordpress_sub_dir.conf
Last active January 28, 2019 00:50
wordpress subdir on nginx with anther nodejs web app
server {
root /home/thixanvat/prod/web;
server_name thixanvat.com www.thixanvat.com;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
location /assets/ {
@nguyentienlong
nguyentienlong / aws_logs_installation_on_ec2.sh
Created September 30, 2018 08:32
aws logs installation on ec2
#!/usr/bin/env bash
# install awscli
python2 -m pip install awscli
# create aws sym link if any issue
ln -s /usr/local/bin/aws /var/awslogs/bin/aws
# install awscli-cwlogs
@nguyentienlong
nguyentienlong / gist:5fb50629d51d91345f22ba5d6be05638
Created December 13, 2018 07:54
good enough - index setting for full text search
"index": {
"analysis": {
"analyzer": {
"lala_analyzer": {
# "tokenizer": "vi_tokenizer",
"tokenizer": "standard",
"char_filter": ["html_strip"],
"filter": [
"icu_folding"
]
@nguyentienlong
nguyentienlong / nginx-tuning.md
Created August 24, 2019 12:42 — 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.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-tutorial
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
backend:
serviceName: default-http-backend
servicePort: 80