Since I’ve chose to run a low-memory VPS for my blog, I decide to install the ‘lnmp’ manually. Here I will show how to do it (install Nginx 1.0.15 + PHP 5.3.12 + MySQL 5.1.62 + eAccelerator 0.9.6.1).
Prepare
1. Of course a pc with Internet connection, virtual machine is the best option if this is the first time.
2. Flush ‘iptables’ if necessary, and shut down SELINUX
3. Download directory is /usr/local/src
Installation
First, download all source code
Then install some libaries, they should be libiconv,libmcrypt,mhash, mcrypt and pcre
|
|
Install MySQL
First, add group in OS for mysql application
Next step is unzip, compile and install. Notice that the LNMP would be intall in /usr/local/webserver
|
|
Then the following script is used to change the directory permissions, make mysql auto start when boot, and for easy management, service command will be use to manipulate mysql
Restart the machine, mysql should be run properly. Follow by setting the root password
|
|
Install PHP
|
|
Modify php-fpm.conf, change the user and group to following:
|
|
Then install eAccelerator
|
|
Modify php.ini
(located in /usr/local/webserver/php/etc/php.ini), change extension_dir = “./”
to extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20090626/"
Configure eAccelerator:
At the end of the file, input the following content:
Install Nginx
First of course add appropriate user group
Install Nginx
Make necessary modification to nginx configuration file
input the following
This only is basic config for nginx, domain configuration for each domain (if you are hosting multi-domain in a server) would be the next:
|
|
input the following. After that php could be supported by nginx. Change domain.com
based on you domain name.
|
|
Create root directory for the domain:
|
|
After all done, create a manage script for nginx ( run $ vi /etc/init.d/nginx first):
|
|
add execute pemission, and set as auto start:
|
|
Environment Specification
Type the following command, and you will get the corresponding result:
|
|
Directory for website files /home/wwwroot/
Directory for all application /usr/local/webserver/
Locations for each configuration file:
|
|