Getting nginx with PHP and MySQL

I managed to install nginx on my laptop. Apache used to eat a lots of my precious RAM previously. My laptop got a mere 3GB of it :-/. I hope nginx would make Web Development much more pleasing as well as allowing my laptop to do other stuffs as well.

Installing nginx is not as straight forward as installing the famous LAMP (Linux, Apache, MySQL and PHP). It requires quite some file configuration ninja skills. Following the tutorial found here.

It was kinda tricky to config the config file ‘/etc/nginx/sites-available/default’.

I was un-commenting everything in the curly braces after ‘location ~ \.php$’ like a dummy. nginx would fail to start. After doing

$ nginx -t

It told me:-
nginx: [emerg] “fastcgi_pass” directive is duplicate in /etc/nginx/sites-enabled/default:61
nginx: configuration file /etc/nginx/nginx.conf test failed

After scanning the file and showing some attention to what was going on, i noticed that i was supposed to un-comment only part for ‘With php5-fpm’ so as it appears like this


location ~ \.php$ {
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

I was feeling too lazy to install phpMyAdmin for database administration. Thought of why not using the command line.

$ mysql -p

The mysql terminal opened.

CREATE DATABASE mybb;

And it worked. I could install the beta version of MyBB Forum software 1.8 😉

Leave a Reply

Your email address will not be published. Required fields are marked *