traditional server vs nginx server

error 404|page 404A|page not found is error from many reason one of them is from rewrite rule. Before that we conclude that a lot of website has been build and combine with apache web server. apache web server bundle in several developer toolkit like XAMPP. Apache become common because complete component inside.

in Low budget hosting like shared hosting, Apache web server become annoying with high CPU load and High RAM consumption. Another web server like lightppd and nginx give solution. In Nginx webserver more lighter than apache. It has different concept, how signal accept in server.

nginx default webserver

every queue in nginx can be finished with some worker. it defferent with default one with one worker so signal become more slow by wait cost.

in Nginx has non blocking concept so it will reduce resource load. In default system show in figure abovetraditional server vs nginx server

in default server every process index with different ones. In Multi Processor or Multi Core include HT (Hyper Threading) different index compute in different section. For computation another pipeline give some improvement. But in network all signal become one rx queue so some CPU wait several time until first one finished. With this non blocking technology nginx become recommended web server for many visitor in low resource.

first time installing this one in your hosting instantly affect load speed. but……

after click page or menu or anything else except home your browser show error 404 or page not found. don`t be panic

in apache web server it has rewrite rule because apache will load htaccess, but in nginx hasn`t.

how to solve this error and prevent error 404 or page not found

At the beginning, I thought the following method was alright till I found out it was generated by Webuzo and gets overwritten by Webuzo every time you make site configuration change.

add code with nano /usr/local/apps/nginx/etc/conf.d/webuzoVH.conf

 

if (!-e $request_filename)
{

Add:

 

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

make it look like:

server {
        listen          80;

 

        server_name     yoursite.com www.yoursite.com;
        # The Document Root

 

        root            /home/admin/www/yoursite.com;
        error_log       /usr/local/apps/nginx/var/log/yoursite.com.err;

 

        access_log      /usr/local/apps/nginx/var/log/yoursite.com.log main;
        include         /usr/local/apps/nginx/etc/conf.d/common;

 

        if (!-e $request_filename)
        {

 

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

 

}

restart nginx

service nginx restart

 

add the rewrite in /usr/local/apps/nginx/etc/conf.d/common

add the following to the file:

#For wordpress
if (!-e $request_filename)

 

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

 

}

Then, restart nginx

service nginx restart

 

read also nginx vs apache comparisson

LEAVE A REPLY

Please enter your comment!
Please enter your name here