hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Web Hosting Talk Tutorials : VPS Tutorials : Installing Web environment on CentOS 6.x: Nginx + PHP-FPM + memcached
Reply

Forum Jump

Installing Web environment on CentOS 6.x: Nginx + PHP-FPM + memcached

Reply Post New Thread In VPS Tutorials Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 05-19-2012, 02:43 AM
Master Bo Master Bo is offline
Hosting seer
 
Join Date: Dec 2002
Location: Novosibirsk, Russia
Posts: 1,512

Installing Web environment on CentOS 6.x: Nginx + PHP-FPM + memcached


Installing proper Web (or other) environment is a common task. Below I provide a link to an archive containing source files and a script to install the following software:
PHP 5.3.10 (FPM enabled) + PHP-FPM FastCGI service
Nginx 1.0.14, high-efficiency Web server (it can also work as Web/mail proxy)
memcached high speed memory caching server (initially created to speed up LiveJournal)

Note that script is no magic wand. I use it to create predefined pieces of software. Custom tuning is always required afterwards, but at least you will have very efficient Web environment with a good average settings.

The script assumes you run CentOS 6.x, 32-bit or 64-bit version, or compatible OS. Note that libmemcached isn't compatible with CentOS 5.x or below, thus the building would break.

How to use: download this archive (14Mb), run antivirus software if you're really paranoid (as I am). Follow the following steps.

1. Unpack the entire archive into
/usr/local/src/arc
(if you choose any other location, change base source directory in
nginx-phpfpm-memcached-install.sh
to whatever meets your needs)

2. Run
nginx-phpfpm-memcached-install.sh
and wait until completion. It may take 10-45 minutes to build all the software, depending on your server efficiency

What this script does:
1. Builds FPM version of PHP 5.3.* and installs XCache opcode cache
2. Builds memcached daemon binary and libmemcached library to communicate with it; also installs PHP memcached PECL extension
3. Builds Nginx and copies a basic configuration suitable for most PHP-driven sites
4. Creates /local/www/localhost as Web root for the default site and places an index.php invoking phpinfo() there

The script adds the following services and marks them to run upon startup:
php53-fpm
nginx

Script also adds memcached to autostart (see /etc/rc.d/rc.local) and adds path to PHP binaries to /etc/profile

Note that script installs software in the following manner:

/usr/local/package-version
and makes a symlink of the kind
/usr/local/package -> /usr/local/package-version

E.g., in case of PHP:
/usr/local/php-5.3.10-fpm
and
/usr/local/php -> /usr/local/php-5.3.10-fpm

This allows you to compile several separate versions and easily assign
any of them as default one.

Note: you are strictly advised to browse and correct
/etc/rc.d/rc.local
- to specify the amount of memory used by memcached
/usr/local/php/lib/php.ini
- to tune your PHP installation to your needs
/usr/local/php/etc/php53-fpm.conf
- to tune your PHP-FPM FastCGI server
/usr/local/nginx/conf/nginx.conf
- to tune your Nginx installation

Make sure you insert proper domain name into nginx.conf. After you do that,
run these commands

Code:
service php53-fpm start
service nginx start
and open the mentioned domain in browser. If everything (including domain's
DNS) are set up correctly, you'll see phpinfo() output.

The script isn't that terribly clever or flexible. Additional functionality might be added if sufficient amount of requests is received. The script is basically what I run to provide the base of Web environment for my sites.

Script understands different versions of the mentioned pieces of software automatically when building. Just replace the source tarballs prior to running and unlink the mentioned symlinks in /usr/local

Bring your comments/suggestions via PM and/or use contact form.

__________________
VPSeer: VPS-related benchmarks, news and how-tos.
"There are two kinds of people in the world, those who haven't lost important data yet, and those who do regular backups."
Network and Server Monitoring Tool - uptime and performance monitoring


Last edited by Master Bo; 05-19-2012 at 02:53 AM. Reason: typos


Sponsored Links
  #2  
Old 05-19-2012, 12:12 PM
investorz investorz is offline
WHT Addict
 
Join Date: Jan 2012
Posts: 137
Many Thanks. It is obvious that you have taken a great deal of effort. I was wondering if there is any distinguishing feature between this and centmin and centminmod. Of course, even if there isn't any difference, I'm going to try this out, but if there are any, I'll keep an eye out for that.

You say the files should be unpacked to "/usr/local/src/arc". Should I create the "arc" directory because that is not there by default.

  #3  
Old 05-19-2012, 12:33 PM
Master Bo Master Bo is offline
Hosting seer
 
Join Date: Dec 2002
Location: Novosibirsk, Russia
Posts: 1,512
Quote:
Originally Posted by investorz View Post
... You say the files should be unpacked to "/usr/local/src/arc". Should I create the "arc" directory because that is not there by default.
Yes, please create /usr/local/src/arc first, I should have mentioned that in the text.

centmin handles other tasks. The script mentioned in this post handles the task of creating of an efficient Web server environment only, using whatever versions of components it finds in its sources directory.

Thanks.

__________________
VPSeer: VPS-related benchmarks, news and how-tos.
"There are two kinds of people in the world, those who haven't lost important data yet, and those who do regular backups."
Network and Server Monitoring Tool - uptime and performance monitoring


Last edited by Master Bo; 05-19-2012 at 12:36 PM.
Sponsored Links
  #4  
Old 05-19-2012, 01:02 PM
investorz investorz is offline
WHT Addict
 
Join Date: Jan 2012
Posts: 137
Yes, it is a very impressive script. Thanks. Only thing is it requires some level of knowledge from the user. So, if you are an advanced user, then you can tweak this to your own specifications which you may not be able to do with other scripts.

  #5  
Old 05-19-2012, 01:04 PM
Master Bo Master Bo is offline
Hosting seer
 
Join Date: Dec 2002
Location: Novosibirsk, Russia
Posts: 1,512
Quote:
Originally Posted by investorz View Post
Yes, it is a very impressive script. Thanks. Only thing is it requires some level of knowledge from the user. So, if you are an advanced user, then you can tweak this to your own specifications which you may not be able to do with other scripts.
Yes, perhaps it needs tweaking and developing. I do not plan to do another centmin, my task is to set up better configurations for a number of CMSes/Web scripts I use.

__________________
VPSeer: VPS-related benchmarks, news and how-tos.
"There are two kinds of people in the world, those who haven't lost important data yet, and those who do regular backups."
Network and Server Monitoring Tool - uptime and performance monitoring

  #6  
Old 05-22-2012, 01:19 AM
web_host_guy_007 web_host_guy_007 is offline
Junior Guru
 
Join Date: Oct 2004
Location: Trivandrum, Kerala, India
Posts: 221
Do you know how to setup wordpress permalinks (custom URLs) in Nginx.

I recently installed nginx server on my VPS but getting 404 not found error when I enabled custom URLs.

There are many tutorials on the web but none of them are working for me.

Anand

__________________
Anand N
Author: Community Server Quickly

Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Nginx /Apache vs. LiteSpeed vs. Nginx /PHP FPM Cyrusexxp Web Hosting 5 05-12-2012 10:52 AM
Nginx w/ PHP-FPM Tyler Systems Management Requests 2 11-09-2011 02:37 AM
Question about nginx + php fpm bonjurkes Hosting Security and Technology 0 07-19-2011 06:55 PM
Nginx + PHP-FPM + MySQL on CentOS. Works on 64MB RAM. dmmcintyre3 VPS Tutorials 30 05-24-2011 04:26 PM
nginx with php-fpm troubles whdev Hosting Security and Technology 4 04-10-2010 01:52 PM

Related posts from TheWhir.com
Title Type Date Posted
Nginx to be Included in Upcoming Ubuntu Release Web Hosting News 2014-01-08 15:17:12
Red Hat Takes Active Role in CentOS Project to Drive New Technology Adoption Web Hosting News 2014-01-08 12:00:22
Nginx Raises $10M to Extend Commercial Support Web Hosting News 2013-10-15 11:20:26
Inside NGINX's First Commerical Product Web Hosting News 2014-05-09 12:40:27
nginx Version 1.4.0 Supports SPDY Protocol Web Hosting News 2013-04-29 15:08:14


Tags
centos 6, how to

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?