Saturday, October 21, 2017
Free SSL Certificate with Let's Encrypt
1. Install git
apt-get install git
2. Create Let's Encrypt source directory
mkdir /opt/letsencrypt
3. Clone source of Let's Encrypt
git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
4. Stop web server (apache, tomcat, nginx...) because they can cause of port 443 error
5. Create certificate for specified domain
cd /opt/letsencrypt
./letsencrypt-auto certonly --standalone -d example.com -d www.example.com
6. All certificates have created in /etc/letsencrypt/live
7. Config fullchain.pem for certificate file, privkey.pem for key file
For HaProxy, create .pem file
cat fullchain.pem privkey.pem > secure.pem
By default, Let's Encrypt issue certificate valid for 90 days, so we need config automatically renew it
1. create auto_renew_cert.sh file as below:
cd /opt/letsencrypt
git pull
service nginx stop
./letsencrypt-auto certonly --quiet --standalone --renew-by-default -d example.com
service nginx start
2. execute it in crontab monthly
echo '@monthly root sh /root/auto_renew_cert.sh >> /var/log/letsencrypt/letsencrypt-auto-update.log' | sudo tee --append /etc/crontab
Saturday, June 24, 2017
Portable Postgres
Postgres full extension 9.6.3 on Debian 8 64bit
https://drive.google.com/open?id=0B30EeVPAcvhvWHpMNDZmbFdNYVk
https://drive.google.com/open?id=0B30EeVPAcvhvWHpMNDZmbFdNYVk
Friday, March 17, 2017
Install Redmine
gem install passenger --no-ri --no-rdoc
passenger-install-nginx-module
passenger-install-nginx-module
http://coderazzi.net/linux/debian/redmine.htm
Thursday, February 9, 2017
Function slower than query direct Postgres
For queries on tables with even data distribution, this will generally be no problem and PL/pgSQL functions will perform somewhat faster than raw SQL queries or SQL functions. But if your query can use certain indexes depending on the actual values in the WHERE clause or, more generally, chose a better query plan for the particular values, you may end up with a sub-optimal query plan.
(source: http://stackoverflow.com/questions/9305133/why-does-postgresql-treat-my-query-differently-in-a-function)
RETURN QUERY : cache plan
RETURN QUERY EXECUTE: replan for each call
(source: http://stackoverflow.com/questions/9305133/why-does-postgresql-treat-my-query-differently-in-a-function)
RETURN QUERY : cache plan
RETURN QUERY EXECUTE: replan for each call
RETURN QUERY EXECUTE $$
//query body
$$ USING param1, param2
Saturday, February 4, 2017
Set static DNS using Ubuntu Deskop 16.04
nano /etc/resolvconf/resolv.conf.d/head
nameserver 8.8.8.8
Monday, January 30, 2017
Panel border shadow is black when sleep or suspend
If you use Unity, just open terminal and type
unityeverything should be ok!
Thursday, January 12, 2017
Connect internet when using OpenVPN - Ubuntu 16.04
1. Setup OpenVPN using network manager
2. Open termainal, type
wlp620: main card connect internet (wifi or cable)
tun0: virtual interface of VPN connection
10.0.0.0 : base ip of VPN connection (ex: 10.0.0.3)
3. Save as changegateway
4. chmod +x changegateway
5. ./changegateway
2. Open termainal, type
default_gateway=$(/sbin/ip route | awk '/default/ { print $3 }')
arr=(`echo ${default_gateway}`);
#echo "${arr[1]}"
sudo route add default gw "${arr[1]}" wlp62s0
sudo route add -net 10.0.0.0 netmask 255.255.255.0 dev tun0
wlp620: main card connect internet (wifi or cable)
tun0: virtual interface of VPN connection
10.0.0.0 : base ip of VPN connection (ex: 10.0.0.3)
3. Save as changegateway
4. chmod +x changegateway
5. ./changegateway
Subscribe to:
Posts (Atom)