Category: Server

How to enable WSGIPassAuthorization in NGINX + DJango

How to enable WSGIPassAuthorization in NGINX + DJango

Just in case we need to enable “WSGIPassAuthorization” in NGINX, we can put this in nginx hosts 12345proxy_pass_request_headers on; proxy_no_cache $cookie_nocache  $arg_nocache$arg_comment; proxy_no_cache $http_pragma     $http_authorization; proxy_cache_bypass $cookie_nocache $arg_nocache $arg_comment; proxy_cache_bypass $http_pragma $http_authorization;

Change / Reset / Update Key Pem Amazon EC2 Simple

Change / Reset / Update Key Pem Amazon EC2 Simple

Here are simple tricks to change or update key PEM in Amazon EC2. At this example, I’m using Ubuntu. To reset or change key pem, all you need just follow this simple steps: Let say, currently we have SERVER_01 and KEYPEM_01. 1234561. Launch a new instances using "launch more like this" (right-click on instances) 2. …

+ Read More

Set Postgresql open for remote access in EC2

Set Postgresql open for remote access in EC2

To make PostgreSQL can be accessible from remote, first in EC2 security, please open your port “5432” (if your installation is using default port). Next, we need to edit pg_hba.conf : /etc/postgresql/9.3/main/pg_hba.conf and add : 1host    all             all             0.0.0.0/0       …

+ Read More

Setup Git in Windows 8

Setup Git in Windows 8

Here are quickstep to setup git in windows : 1. Download git from http://git-scm.com/download/win 2. In Installation, make sure to enable git and linux command in command prompt (yes, the red text) Now, git can be accessed from your command prompt. Next step is generate ssh key for windows. Go to git bash (you can …

+ Read More

Solve VSFTPD error retrieving directory Ubuntu

Solve VSFTPD error retrieving directory Ubuntu

Suddenly i got this “error retrieving directory, connection timeout ..” when accessing ftp EC2 server. Then, the solution just change my FTP client from “passive mode” into “active mode”. Weird but works!

Set EBS as root partition on EC2

Set EBS as root partition on EC2

We can replace main partition in EC2 using EBS for larger space. Make sure to use HVM instead of Paravirtual. First thing, we need to create a new EBS and attach it into running instance. Now, we should login into our SSH server. 1. Copy old instance into new instance Find what your root partition …

+ Read More

Solve gitignore not working windows

Solve gitignore not working windows

The solution gitignore not working windows 123git rm -r –cached . git add . git commit -m ".gitignore is now working" For android, .gitignore can be : 1234gen/ bin/ project.properties .gitignore

Solve [error] 28901#0: *401 upstream sent too big header while reading response header from upstream

Solve [error] 28901#0: *401 upstream sent too big header while reading response header from upstream

Today I got this 502 error on my websites : 1Solve [error] 28901#0: *401 upstream sent too big header while reading response header from upstream, client: 116.86.214.27, server: yodi.biz, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "yodi.biz" After looking at NGINX documentation, i found the problem in my fastcgi buffers. So, the solution is just …

+ Read More

Install LXML in Debian

Install LXML in Debian

To install LXML python module in Debian, you need to install depedency packages : 1apt-get install python-dev libxml2 libxml2-dev libxslt1-dev libbz2-dev libssl-dev p7zip-full rar lha unrar unzip unace unp bzip2 gzip patch Then, you can install lxml by : 1pip install lxml

Solving Bind DNS un-resolved when nslookup domain without WWW

Solving Bind DNS un-resolved when nslookup domain without WWW

This is common mistake when we try to nslookup our domain that working with “WWW” but not without “WWW”. This is some bind9 configuration : 123456789101112131415; ; BIND data file for local loopback interface ; $TTL    3600 @       IN      SOA     obroll.com. admin.obroll.com. (         …

+ Read More

How to install and uninstall sphinx search from source in Ubuntu

How to install and uninstall sphinx search from source in Ubuntu

Instead using synaptic and install sphinxsearch deb package, we also can use the source. First, you should download source package from the sphinxsearch website http://sphinxsearch.com/downloads/. At this example, I use sphinx-2.0.4-release.tar.gz. I use Ubuntu 12.04 Precise. Then you can extract it and start compiling. Here are the steps to do : 123456sudo apt-get install build-essential …

+ Read More

NGINX *1 upstream sent too big header while reading response header from upstream

NGINX *1 upstream sent too big header while reading response header from upstream

When I login into WordPress Administration page, I got it blank pages. Curious about what happend, I go through into NGINX error.log and I see this error : 1*1 upstream sent too big header while reading response header from upstream Then to solve this problem, I need to add “fastcgi_buffers 8 256k;” and “fastcgi_buffer_size 128k;” …

+ Read More

Solve recv() failed (104: Connection reset by peer) 502 NGINX Bad Gateway PHP5 FPM

Solve recv() failed (104: Connection reset by peer) 502 NGINX Bad Gateway PHP5 FPM

When I host many wordpress sites under NGINX + PHP5-FPM on Ubuntu Oneiric, everything is smooth and there no problem. Suddenly, after a few month, I got error NGINX 502 Gateway on my cron. Then after dive into NGINX error.log, I see this error : 122012/03/19 14:20:21 [error] 2383#0: *334 readv() failed (104: Connection reset …

+ Read More

How to open PostgreSQL remote access with IP address limitation on Ubuntu

How to open PostgreSQL remote access with IP address limitation on Ubuntu

When trying to configure postgresql to be able accessed remotely from another IP address, we usually got several errors like this : 1234postgresql remote access no pg_hba.conf entry for host psql: FATAL:  no pg_hba.conf entry for host "xxxxx", user "xx", database "xxxx", SSL on FATAL:  no pg_hba.conf entry for host "xxxx", user "xx", database "xxx", …

+ Read More

Awk sed total bot access.log Apache Ubuntu

Awk sed total bot access.log Apache Ubuntu

We can mining and calculate Bot from access.log Apache2 using awk and sed. To get rank and total list of Bot that visit our webpages, then go to “/var/log/apache2” and this scripts : 1awk ‘{print $12}’ access.log.1 | sort | uniq -c | sort -nr

How to create user postgresql using Pgadmin Ubuntu

How to create user postgresql using Pgadmin Ubuntu

Create postgresql new user using Pgadmin in Ubuntu is very easy. First, launch your Pgadmin that used “postgres” account and connect into localhost. Then, after login, expand your “localhost” item and find “Login Roles“. Right click on “Login Roles”. Then create your users and setup the permission.

Example how to git submodule, add, delete submodule and use existed git repository

Example how to git submodule, add, delete submodule and use existed git repository

Git submodule is great feature on Git which it will needed much on large projects than build by small parts. For example, I have single project called “Insurance”. This project contains several apps like “billing”, “user”, “backend” and several apps. We want to create single repository that contain several small repositories. Using git submodule will …

+ Read More

How to Virtualbox Guest share wireless connection from host Ubuntu

How to Virtualbox Guest share wireless connection from host Ubuntu

I usually use LAN cable and share internet connection using NAT to Virtualbox client. But, I need to connect using Wireless int my Host and found NAT can’t works through this connection. So, share internet connection from wireless to Virtualbox guest, we should use “bridge-network”. Go Virtualbox Client Settings -> Network -> Bridge network and …

+ Read More

Solve cannot create /etc/ssh/sshd_config: Directory nonexistent deleted ssh folder Ubuntu

Solve cannot create /etc/ssh/sshd_config: Directory nonexistent deleted ssh folder Ubuntu

Today I made mistake by deleting “/etc/ssh” folder manually. Then when I try to re-install openssh-server in Ubuntu Oneiric, it gave me several errors like this : 12345678910111213/var/lib/dpkg/info/openssh-server.postinst: 456: cannot create /etc/ssh/sshd_config: Directory nonexistent dpkg: error processing openssh-server (–configure):  subprocess installed post-installation script returned error exit status 2 dpkg: dependency problems prevent configuration of ssh: …

+ Read More

How to login postgresql access psql from ubuntu user

How to login postgresql access psql from ubuntu user

I use Ubuntu 11.10 Oneric and Postgresql 9.1 in this cases. So, when I need to dump database using “psql -U postgres” from ubuntu, I got several error like this : 123psql: FATAL:  role "ubuntu" does not exist psql: FATAL:  Peer authentication failed for user "postgres" psql: FATAL:  Peer authentication failed for user "postgres"

WordPress NGINX configuration solve gateway timeout

WordPress NGINX configuration solve gateway timeout

You facing NGINX gateway timeout in wordpress. You already change php.ini and increase timeout but not solve the problem yet. Also, you increase timeout in HAProxy and not results yet. Then the problem come inside NGINX. Some cases it’s happen because Fast CGI timeout is so tight. Also, it because client response timeout also small. …

+ Read More

How to make ssh into server without password

How to make ssh into server without password

This is mostly needed by beginner network admin which login into several server from their laptop / PC and inserting password each login. We can avoid this inserting password by using public keys. Now, go to client and generate public key by : 1ssh-keygen -t rsa

Setup VPS / Server from beginning for WordPress sites with NGINX + MySQL Ubuntu

Setup VPS / Server from beginning for WordPress sites with NGINX + MySQL Ubuntu

I will guide you about how to setup brand new VPS / Server to host WordPress with optimize configuration. I prefer use NGINX + MySQL here. Remember, I start from zero configuration with mean no software installed , no pre-installed program and default Ubuntu. If you want to install several VPS / Server, then you …

+ Read More

How to ping and SSH Ubuntu Guest Host Virtualbox

How to ping and SSH Ubuntu Guest Host Virtualbox

By default SSH & ping between Virtualbox Guest and Host is disabled. Virtualbox make NAT connection between Host and Guest so we can have internet connection in Guest. To make Host and Guest can communicate in two ways, here are the steps : 1. Create vboxnet0 network device. If you don’t have this vboxnet, you …

+ Read More