• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Nginx. Quick question

brendanc

Active member
#3
Hi!
I see that my server company can install and configure nginx for free.

This is what they are going to do:
https://help.asmallorange.com/index...View/269/21/nginx-acceleration-stack-overview

Do you think that it's enough to give a boost to my server speed?

Thanks for your answers.
If you don't know or don't want to put time into learning how to tune nginx, please don't make the switch. It will most certainly cause more problems than it solves.

NGINX is a completely different animal when it comes to php, etc. and as such should not be treated as a drop-in replacement for apache as a "free" performance boost. It is anything but "drop-in" and requires a lot of time and effort to get working more efficiently than apache.

If you're not the tweaker type, it's probably best you stick to Apache, or if you're itching to do some upgrading, switch from Apache 2.2 to 2.4 to get a similar I/O process to NGINX (non-blocking).

I don't say this to scare you off, but just to warn you that it could be a huge headache if you don't know what you're doing.
 

jgas

Active member
#5
If you don't know or don't want to put time into learning how to tune nginx, please don't make the switch. It will most certainly cause more problems than it solves.

NGINX is a completely different animal when it comes to php, etc. and as such should not be treated as a drop-in replacement for apache as a "free" performance boost. It is anything but "drop-in" and requires a lot of time and effort to get working more efficiently than apache.

If you're not the tweaker type, it's probably best you stick to Apache, or if you're itching to do some upgrading, switch from Apache 2.2 to 2.4 to get a similar I/O process to NGINX (non-blocking).

I don't say this to scare you off, but just to warn you that it could be a huge headache if you don't know what you're doing.
I completely agree.
In fact, nginx has been installed and my server crashed a few hours later.
So for nox this option is off the table, since I don't have time, unfortunately, to learn.

Quick question: since my users are in Italy, and my server in the US, I need in some way to give a boost to the site connection.
I'm thinking in 2 options: litespeed, or maxcdn. What would you recommend?

Note that I also use cloudflare.

Thanks =)
 
#6
I completely agree.
In fact, nginx has been installed and my server crashed a few hours later.
So for nox this option is off the table, since I don't have time, unfortunately, to learn.

Quick question: since my users are in Italy, and my server in the US, I need in some way to give a boost to the site connection.
I'm thinking in 2 options: litespeed, or maxcdn. What would you recommend?

Note that I also use cloudflare.

Thanks =)
Regional latency isn't something you're going to solve or even alleviate with different server technology. The only solution is to move your server to where your users are or cache your web site somewhere in between (physically).

Why not just get a host with servers in Europe to solve the problem properly?
 

Floren

Well-known member
#7
NGINX is a completely different animal when it comes to php, etc. and as such should not be treated as a drop-in replacement for apache as a "free" performance boost. It is anything but "drop-in" and requires a lot of time and effort to get working more efficiently than apache.
Very well put/said, eventually people will understand that installing Nginx on their server is not a "set it and forget it" recipe or copy/paste from Internet. Sometimes I get mocked on these forums when I tell people to read the documentation, instead of posting spoon feeds. Thank you for highlighting what is the essence of Nginx.
Quick question: since my users are in Italy, and my server in the US, I need in some way to give a boost to the site connection.
I serve my site with OVH from Canada and I get decent times all over the world.
No Cloudflare or other gimmicks, few examples:
Checkpoint: Ashburn, VA, USA OK
Result: 0 - OK Total Time: 0.388 sec.
Resolve time: 0.000 sec. Total bytes: 27976 bytes
Connection time: 0.073 sec. Download time: 0.315 sec.

Checkpoint: Athens, Greece OK
Result: 0 - OK Total Time: 0.647 sec.
Resolve time: 0.014 sec. Total bytes: 28055 bytes
Connection time: 0.149 sec. Download time: 0.484 sec.

Checkpoint: Auckland, New Zealand OK
Result: 0 - OK Total Time: 0.882 sec.
Resolve time: 0.024 sec. Total bytes: 28053 bytes
Connection time: 0.205 sec. Download time: 0.653 sec.

Checkpoint: Beijing, China OK
Result: 0 - OK Total Time: 2.009 sec.
Resolve time: 0.002 sec. Total bytes: 27976 bytes
Connection time: 0.397 sec. Download time: 1.610 sec.

Checkpoint: Berlin, Germany OK
Result: 0 - OK Total Time: 0.447 sec.
Resolve time: 0.002 sec. Total bytes: 27976 bytes
Connection time: 0.107 sec. Download time: 0.338 sec.

http://www.uptrends.com/aspx/free-website-server-network-monitoring-tool.aspx
 
Last edited:

D.O.A.

Well-known member
#8
I don't read the documentation and I have 400-1300 online at any given time, on one cheapish control panel-less server in the US. It's like a car, you can drive it, put oil in it and stuff around but you don't have to be a mechanic (although irl I am)

Capture.JPG
 
#9
I disagree with the above points because I think they oversell Apache.

Nginx is not any harder than Apache. If your distro has Nginx packages then it will be just as stable and "drop-in" as Apache is without the LAMP server config helpers. You'll just have to connect Nginx with your PHP handler.

The reason I say this is because Apache is just as "drop-in" as Nginx as far as fine tuning. Most people just deploy a LAMP server and never give it a second though. The vast majority of Apache servers are very poorly configured for the use case which is one of the reasons Apache gets such a bad rap.

When it comes down to it there are a few things you need to know about Nginx and if you follow these guidelines you'll get some benefit over Apache:

1. Don't serve your static assets through your PHP handler. Most distros have this configured in the default vhost already via a static extension regex.

2. Don't allow arbitrary code execution. This is something Apache is also prone to if configured incorrectly.

3. Don't copy location blocks from Google that contain "if" statement unless you understand them in detail.

One thing Nginx has over Apache is that all of these points are covered in official documentation in the Nginx Pitfalls article. If you can get Nginx to work without running into any of those problems you'll be just fine.
 

Tracy Perry

Well-known member
#10
Can't really complain about mine (China showed 0.00 - but that's because all traffic from them is dropped). Server is based in Florida with ServerComplete.

screenshot.png
 

brendanc

Active member
#11
I disagree with the above points because I think they oversell Apache.

Nginx is not any harder than Apache. If your distro has Nginx packages then it will be just as stable and "drop-in" as Apache is without the LAMP server config helpers. You'll just have to connect Nginx with your PHP handler.

The reason I say this is because Apache is just as "drop-in" as Nginx as far as fine tuning. Most people just deploy a LAMP server and never give it a second though. The vast majority of Apache servers are very poorly configured for the use case which is one of the reasons Apache gets such a bad rap.

-snip-
I guess we can agree to disagree here then, because NGINX is definitely developer-oriented out of the box whereas Apache is much more user friendly and configuration is much easier to understand.

I'm not "overselling" Apache in this instance--I run NGINX just fine myself and have championed/maintained it at several of my employers for both development and production servers. It is not however, for the faint of heart.

Apache's configuration format (tag blocks, etc) and VirtualHosts are a much simpler concept than NGINX's server blocks for people not well-versed in server administration. There is, objectively, a much steeper learning curve for NGINX.

With Apache, you can simply load the php module in your config, restart the process, and voila, you've got PHP running now. With NGINX, you have to install php-fpm (and configure that, too!), decide whether you want to use socket or port upstream, and configure your server block to only process PHP files. Not to mention the complexity of configuring how requests are sent to your PHP scripts (.htaccess is also much easier in this regard, since there is no reloading of the server config).

I agree with you that both are capable of being fine-tuned, but out of the box, NGINX is not nearly as safe a bet as Apache is.
 
#12
I guess we can agree to disagree here then, because NGINX is definitely developer-oriented out of the box whereas Apache is much more user friendly and configuration is much easier to understand.

I'm not "overselling" Apache in this instance--I run NGINX just fine myself and have championed/maintained it at several of my employers for both development and production servers. It is not however, for the faint of heart.

Apache's configuration format (tag blocks, etc) and VirtualHosts are a much simpler concept than NGINX's server blocks for people not well-versed in server administration. There is, objectively, a much steeper learning curve for NGINX.

With Apache, you can simply load the php module in your config, restart the process, and voila, you've got PHP running now. With NGINX, you have to install php-fpm (and configure that, too!), decide whether you want to use socket or port upstream, and configure your server block to only process PHP files. Not to mention the complexity of configuring how requests are sent to your PHP scripts (.htaccess is also much easier in this regard, since there is no reloading of the server config).

I agree with you that both are capable of being fine-tuned, but out of the box, NGINX is not nearly as safe a bet as Apache is.
I'd argue XML config is much less user friendly than INI config for non-developers.
 

brendanc

Active member
#13
I'd argue XML config is much less user friendly than INI config for non-developers.
How so? It looks more like HTML and you always know where a block ends because of the named tags? If an NGINX config is poorly written, it can be difficult to tell where one pair of brackets starts and ends.
 
#14
Writing xml or ini config directives for me it's the same. What's more bigger issue is that Apache has much better documentation and much wider array of examples how to do something. So it is easier to do what you want with Apache.

P.S. That doesn't mean that Apache is better, in my opinion Nginx at least 100 times better then Apache :)