Still use Apache Server? .. is outdated.

Use Nginx, especially if one package with PHP-FPM for PHP Handler is guaranteed perfect. Web will feel light, although thousands of visitors will not feel anything. Coupled with module memchache + cloudflare getting more light again.

nginx performanceNginx is widely used by large webs that have thousands of visitors. The reliability is unquestionable. Nginx is able to work with low RAM memory support and does not spent high CPU power. However, the common Nginx problem is not working on the Rewrite module. That’s because Nginx does not read .htaccess, unlike Apache which has the Rewrite facility through .htaccess. Nginx has a special code in order to rewrite.

Joomla and WordPress will fail loading while reading the rewrite code on nginx. The message “Error 502” will appear. Well, how do I get Joomla and WordPress running on Nginx? I will share it here.

Here I am using Nginx Web Server from Centmin Mod, which has active development and extensive forum support. Many other modules, such as VPSSIM, or LEMP Stack, which provides Nginx installation facilities. But, I’ve tried everything, and finally dropped the option on Centmin Mod.

The OS I use is Linux Centos 6 64 bit. For installation of Centmin Mod (Nginx Stack) is as follows:

1. Login to root with Putty or Bitvise SSH.
2. Enter the command to install Centmin:

cd /usr/local/src

curl -sL http://centminmod.com/installer.sh | bash

The system will automatically download and install Centmin Mod (Nginx + PHP-FPM and various other modules, such as Memcache, APC, and more.) Wait until it’s done (pretty old approx 30 minutes).
(After install centmin, to install wordpress, step by step can be seen completely in this link And, for phpmyadmin in this link).

3. Once done, open the igbinary.ini file that is on

/etc/centminmod/php.d/

or you can use

nano /etc/centminmod/php.d/igbinary.ini

4. Edit line session.serialize_handler = igbinary, add mark; (semicolon) in front of it, becomes like this:

session.serialize_handler=igbinary

to

;session.serialize_handler=igbinary

Save with CTRL + O command and exit with CTRL + X command.
The function of this command is that Joomla and WordPress can go to Backed or Administrator. Without edit igbinary.ini Joomla and WordPress will not be able to login to the backend.

5. Find the Nginx vhost file for the domain you entered, for example domain.com.conf in the /usr/local/nginx/conf/conf.d folder
6. Edit and enter the following code, so the full code will look like this:

server {

server_name domain.com;

server_name_in_redirect off;

 

# ngx_pagespeed & ngx_pagespeed handler

#include /usr/local/nginx/conf/pagespeed.conf;

#include /usr/local/nginx/conf/pagespeedhandler.conf;

#include /usr/local/nginx/conf/pagespeedstatslog.conf;

 

# limit_conn limit_per_ip 16;

#ssi  on;

 

access_log /home/nginx/domains/domain.com/log/access.log combined buffer=32k;

error_log /home/nginx/domains/domain.com/log/error.log;

 

root /home/nginx/domains/domain.com/public;

 

location / {

 

#block common exploits, sql injections etc

#include /usr/local/nginx/conf/block.conf;

 

# Enables directory listings when index file not found

#autoindex  on;

 

# Shows file listing times as local time

#autoindex_localtime on;

 

# Enable for vBulletin usage WITHOUT vbSEO installed

#try_files         / /index.php;

try_files $uri $uri/ /index.php?q=$request_uri;

}

#pass php files to fastcgi

location ~ \.php$

{

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

include /usr/local/nginx/conf/fastcgi_params;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

#set expires to 0 to stop caching of php files

expires 0;

}

location ~ ^/

{

#set expires to 30d to cache static files

expires 30d;

#file doesn’t exist, will need to be sent to php

if (!-e $request_filename)

{

rewrite ^/(.*)$ /index.php?q=$1 last;

}

}

# caching of files

location ~* \.(ico|pdf|flv)$ {

expires 1y;

}

location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {

expires 14d;

}

include /usr/local/nginx/conf/staticfiles.conf;

include /usr/local/nginx/conf/php.conf;

include /usr/local/nginx/conf/drop.conf;

#include /usr/local/nginx/conf/errorpage.conf;

}

Note: replace domain.com with the domain name you entered.

7. Finally, enter the comment Chown -R, Folder Permission 755.

cd  /home/nginx/domains/domain.com/

chown -R nginx:nginx public

Already completed. Your Joomla or WordPress will run seamlessly on Nginx web server and can rewrite as in Apache. So for the SEO problem there will be no problem.

speed comparrison between using Apache Web Server with the following Nginx:

Menggunakan Apache Web Server dan Cpanel:

comparrison nginx and apache

After using Nginx without the Control Panel, the speed becomes under 2 seconds ..wooow, and without the errors “Internal Server Error” is very disturbing if using Apache Web Server:

nginx vs apache

 

3 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here