Configure logs in Apache for virtualhost

First of all, let’s distinguish between error logs and access logs.

In this guide you can see how:

http://www.sitepoint.com/configuring-web-logs-apache/
https://www.digitalocean.com/community/tutorials/how-to-configure-logging-and-log-rotation-in-apache-on-an-ubuntu-vps

But, I noticed that there was not info in the apache /var/log/apache2.access log

The trick is to add one line to the virtualhost that you would like to control:

CustomLog /var/log/apache/www.foo.com-access.log combined

source: http://wiki.apache.org/httpd/ExampleVhosts

Configuring Postgres Ubuntu

Following our previous post, we now explain how to access Postgres through the command line.

First a modification has to be made in the config files:

nano /etc/postgresql/9.1/main/pg_hba.conf

uncomment the line and put

local all username md5

Where username is the user you created

then restart:

sudo /etc/init.d/postgresql restart

now you will be able to access:

psql database_name username

and you will be requested to enter the password

How to install Postgres 9.1 in Ubuntu 12.10

Follow this guide:

https://gist.github.com/andremendonca/5991965/raw/73d3f88aa53d6ef85443c7c24ecc302713eb129d/install+postgree+on+ubuntu

# STEP 1: VERIFY THAT YOU DO NOT ALREADY HAVE POSTGRESQL INSTALLED ON YOUR SYSTEM
ps ax | grep postgres

# STEP 2: INSTALL POSTGRESQL ON YOUR SYSTEM
sudo apt-get update
sudo apt-get install postgresql-9.1

# List All Postgres related packages
dpkg -l | grep postgres

# * No PostgreSQL clusters exist; see “man pg_createcluster”
# STEP 2.1: CREATES A NEW POSTGRESQL SERVER CLUSTER
# http://serverfault.com/a/234993
pg_lsclusters
pg_createcluster 9.1 main –start

# STEP 2.2: change user to the PostgreSQL user
sudo su – postgres

# STEP 3: CONFIGURE YOUR POSTGRESQL PASSWORD
#IF changed to user Postgre already
psql -d postgres -U postgres

Configure sendmail in Ubuntu 12.04 and make it fast!

I got a server in DigitalOcean and installed WordPress.

To my surprise, sending mail was not something pre-configured so I had to find a way. I did not want to use SMTP solutions but use a simple Unix package such as sendmail or postfix.

It seems that sendmail is simpler, and good enough if you only want to send mails. That is my case, because I just want to receive notifications from WP, such as the ones that contact form 7 sends everytime a form is filled up and sent.

So I looked at tutorials, and the simplest thing to do was

1) If sendmail is not installed, do install it:
apt-get install sendmail
2) Configure hosts file correctly:
nano /etc/hosts
And make sure the line looks like this:
127.0.0.1 localhost localhost.localdomain yourhostnamehere
3) Reload /etc/hosts, so that the previous changes take effect
sudo /etc/init.d/networking restart that works but seems to be deprecated, better use:
/etc/init.d/networking stop
/etc/init.d/networking start

4) Run the sendmail config and answer ‘Y’ to everything:
sendmailconfig

source: https://www.digitalocean.com/community/questions/php-mail-function-enable

Thanks to Colling Henderson for the help, which I also found when digging further about the sluggishness of sendmail, in his blog: http://collinhenderson.com/post/48046976172/a-fix-for-slow-sendmail-on-ubuntu

It is of utmost importance that you make sure the of point 2 string “localhost.localdomain” is in there. I did not take it seriously the first time I read it, but it does make a big difference. If you don’t change it, the php send function will be sooooo slow.

By the way, I also followed the instructions here: http://www.devraju.com/php/slow-email-sending-in-ubuntu-12-04-lts-solution/ and I am not sure how much changing the line in the sendmail.cf is affecting the speed. To me it was the fact that the string “localhost.localdomain” what really made the difference from some 1 minute to 2 seconds!!!!

more performance for your WordPress install

i look forward to installing my next WP blog under nginx

This guide looks a good start:

https://www.digitalocean.com/community/articles/how-to-install-wordpress-nginx-php-and-varnish-on-ubuntu-12-04

and this for a Varnish improvement

https://www.digitalocean.com/community/articles/how-to-install-wordpress-nginx-php-and-varnish-on-ubuntu-12-04

and if you have a Mac, then you can install locally this set

MNPP: http://getmnpp.org/