Wednesday, March 19, 2014

Config Nginx làm Reverse Proxy cho Apache

Với lợi thế là tốc độ nhanh, sử dụng ít tài nguyên hệ thống; Nginx thường được cấu hình làm Reverse Proxy cho Apache server. Trong hướng dẫn này Nginx và Apache được cài đặt trên hệ điều hành Ubuntu  12.04.

Wednesday, March 5, 2014

Bash History: Display Date And Time For Each Command

How do I display shell command history with date and time under UNIX or Linux operating systems?

Monday, March 3, 2014

Optimizing Django: tricks for faster page loads

By reducing the file size of your CSS, JavaScript and images, as well as the number of unnecessary browser requests made to your site, load time of your applications pages can be drastically reduced, not to mention the load on your server.
Yahoo have created a list of the 35 best practices to speed up your website, a recommended read for any web developer. I wanted to summarize a few I recently implemented in a Django application.
In a nutshell:
  • Serve compressed static media files. This one is obvious, the smaller the file size, the quicker it is to download.
  • Once a browser has already downloaded the static media, it shouldn't have to download it again. This is what actually happens, as the server will respond with 304 Not Modified, which means that the cached file is still up-to-date.
  • However, the HTTP request is still sent. This is unnecessary and should be avoided by setting the HTTP Expire header to a date in the future.
  • When files are updated, you need to give them a new URL so the browser will request them. This is referred to as versioning. A common scheme is to use the modification time/date of the file in its URL, either as part of the name or in the query string. This is obviously tedious and error prone, so automation is required.