SocialEngine & NGINX Integration
Written by Andrew Cross Friday, 15 March 2013
Do you have a dedicated Server? Would you like Social Engine to be faster? Why not install NGINX follow this Guide to integrate SocialEngine 4 + NGINX + FastCGI PHP5 + CentOS 5.4
Migrating your SocialEngine install from APACHE to NGINX
Packages provided by integration4us.com
Step # 1: Enable EPEL repo
NGINX is not included in the base system. Turn on
EPEL repo to install NGINX stable release:
Login to your server as root from ssh
for 32bit System
# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
for 64bit System
# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
List new repo:
# yum repolist
Step # 2: Install NGINX + FastCGI PHP5
Type the following command at a shell prompt:
# yum install nginx
Sample output:
Loaded plugins: downloadonly, fastestmirror, priorities, protectbase Loading mirror speeds from cached hostfile * epel: archive.linux.duke.edu * base: ftp.linux.ncsu.edu * updates: centos.mirror.nac.net * addons: mirror.cs.vt.edu * extras: centos.mirror.nac.net 0 packages excluded due to repository protections Setting up Install Process Parsing package install arguments Resolving Dependencies --> Running transaction check ---> Package nginx.x86_64 0:0.6.34-1.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================== Package Arch Version Repository Size ============================================================================================================================================================== Installing: nginx x86_64 0.6.34-1.el5 epel 319 k Transaction Summary ============================================================================================================================================================== Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s) Total size: 319 k Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : nginx [1/1] Installed: nginx.x86_64 0:0.6.34-1.el5 Complete!
nginx configuration file
- Default config file: /etc/nginx/nginx.conf
- Default SSL config file: /etc/nginx/conf.d/ssl.conf
- Default virtual hosting config file: /etc/nginx/conf.d/virtual.conf
- Default documentroot: /usr/share/nginx/html
Configure PHP5 As FastCGI
Install php5 with other modules and if you have them installed already but just to make sure everything is there, type the following:
# yum install php-pear-Net-Socket php-pear php-common php-gd php-devel php php-mbstring php-pear-Mail php-cli php-imap php-snmp php-pdo php-xml php-pear-Auth-SASL php-ldap php-pear-Net-SMTP php-mysql
Install spawn-fcgi simple program for spawning FastCGI processes
Type the following command:
# yum install spawn-fcgi
Next, download spawn-fcgi
init.d shell script:
# wget http://integration4us.com/SE4_NGINX_INSTALLATION_FILES/php-fastcgi
# mv php-fastcgi /etc/init.d/php-fastcgi
# chmod +x /etc/init.d/php-fastcgi
Start php app server, enter:
# /etc/init.d/php-fastcgi start
# netstat -tulpn | grep :9000
Sample output:
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 14294/php-cgi
Step # 3: Setup SocialEngine + NGINX Configuration
Download the configuration file to run SocialEngine script in NGINX
# wget http://integration4us.com/SE4_NGINX_INSTALLATION_FILES/default.conf
# mv default.conf /etc/nginx/conf.d/
Assuming your system has only one website because other website in the system will no longer work after this.
Stop apache if it’s running and disable it from loading in future:
# service httpd stop
Now restart nginx:
# service nginx restart
Step # 4: Migrating your SocialEngine install from APACHE to NGINX
Assuming your system installation is based on WHM/CPanel
# mv /usr/share/nginx/html /usr/share/nginx/html_ORIG
# mv /home/<CPANELUSERNAME>/public_html /usr/share/nginx/html
# ln -s /usr/share/nginx/html /home/<CPANELUSERNAME>/public_html
<CPANELUSERNAME> is where you SocialEngine is installed
Step # 5: That’s it!
Hope this has helped you
Looking for quality SocialEngine Web Hosting? Look no further than Arvixe Web Hosting!
