Get Maximum out of 4.3.1: The Best Server Configuration

[quote name='kogi' timestamp='1430642538' post='213230']

So without the rules, will SEO work under nginx?

[/quote]

[font=Arial, sans-serif]Without rules[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]of SEO[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]will not work.[/font]

[quote name=‘goncharov’ timestamp=‘1430644990’ post=‘213233’]

[font=Arial, sans-serif]Without rules[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]of SEO[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]will not work.[/font]

[/quote]



So, Can cscart (you guys) provide working Nginx config for SEO? :D

Sure. Just example:


server {
listen 80;
server_name _;
root /var/www/empty;
location / {
return 301 $scheme://example.org$request_uri;
}
}
server {
listen 80;
server_name example.org www.example.org;
charset utf-8;
access_log /var/log/nginx/access.log combined;
error_log /var/log/nginx/error.log;
root /var/www/html/example.org;
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types text/plain application/xml
application/javascript
text/css
text/js
text/xml
application/x-javascript
text/javascript
application/json
application/xml+rss;
client_max_body_size 100m;
client_body_buffer_size 128k;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
client_header_buffer_size 1k;
large_client_header_buffers 4 16k;
location / {
root /var/www/html/example.org;
index index.php index.html index.htm;
rewrite ^/api/(.*)$ /api.php?_d=$1&ajax_custom=1&$args last;
try_files $uri $uri/ @fallback;
}
location @fallback {
rewrite ^(.*)$ /index.php?$args last;
}
location ~* \.(jpeg|ico|jpg|gif|png|css|js|pdf|txt|tar|gz|wof|csv|zip|xml|yml) {
access_log off;
try_files $uri @statics;
expires 14d;
add_header Access-Control-Allow-Origin *;
add_header Cache-Control public;
root /var/www/html/example.org;
}
location @statics {
rewrite ^/(\w+)/(.*)$ /$2 break;
access_log off;
rewrite_log off;
expires 14d;
add_header Cache-Control public;
add_header Access-Control-Allow-Origin *;
root /var/www/html/example.org;
}
location ~ \.php$ {
root /var/www/html/example.org;
proxy_read_timeout 61;
fastcgi_read_timeout 61;
try_files $uri $uri/ =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location /app/ {
deny all;
location ^~ /app/addons/rus_exim_1c/exim_1c.php {
allow all;
}
}
location /app/payments/ {
allow all;
}
location /design/ {
allow all;
location ~* \.([tT][pP][lL]|[pP][hH][pP].?)$ {
deny all;
}
}
location /images/ {
allow all;
location ~* \.([pP][hH][pP].?)$ {
deny all;
}
}
location /var/ {
deny all;
location ~* \.(js|css|png|jpg|gz|xml|yml)$ {
allow all;
expires 1M;
add_header Cache-Control public;
add_header Access-Control-Allow-Origin *;
}
}
location /var/database/ {
deny all;
}
location /var/skins_repository/ {
allow all;
location ~* \.([tT][pP][lL]|[pP][hH][pP].?)$ {
deny all;
}
}
location ~* api/ {
rewrite ^/api/(.*)$ /api.php?_d=$1&ajax_custom=1&$args last;
}
location ~ /\.ht {
deny all;
}
}

@goncharov



Thanks, you are the best!

[quote name='goncharov' timestamp='1430638399' post='213225']

[font=Arial, sans-serif]I mean o[/font][font=Arial, sans-serif]n the Internet[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]there is no independent research of performance,[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]with the exception of tests[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]LitespeedTech[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]where[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]LS[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]wins[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]an incorrectly configured[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]NGINX[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]and Apache[/font][font=Arial, sans-serif]. In my opinon, p[/font][font=Arial, sans-serif]resented on[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]the official website of the[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]benchmarks are[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]ridiculous[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]and[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]not objective. [/font][font=Arial, sans-serif]I urge people[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]not[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]to take their word[/font][font=Arial, sans-serif].[/font]

[/quote]

I find your statements a little strange because one Google search will give you many independent benchmarks for litespeed. Here are a few from the first google page:

http://centminmod.co…d_cherokee.html

[url=“OpenLiteSpeed vs Nginx benchmarks and initial thoughts | vbtechsupport.com”]http://vbtechsupport.com/2204/[/url]

http://www.webhostin…d.php?t=1024547

http://www.vbulletin…orge-l/3929797-

http://www.beyondcod…and-plain-html/

http://www.rootusers…ance-benchmark/

http://www.rubyenter…omparisons.html



This puts the benchmarks of litespeedtech into perspective: http://openlitespeed…-benchmarks.59/

Maybe your opinion on litespeed benchmarks is based on the situation years ago? BUt since then many people have done benchmarks and it came out very good.



Basically what it boils down to is that NGINX and LSWS are pretty on par with each other in terms of performance. LSWS has the benefit that its much easier to configure and has a lot of extra functions. For a very technical webmaster NGINX can be more appealing.



Based on these independent benchmarks we became interested in litespeed years ago. To see if it would as well for us, we did our own benchmarks to see the difference between Apache and LSWS. The difference was amazing. It was one of the best decisions ever to move to LiteSpeed. It saves us a lot of money in hosting costs and our websites are much faster do to litespeed cache. Except CS-Cart that is.

I think bench marking is pointless if you go by other peoples results. It's like looking for one spasific pea in a can of peas. And for me setting my own bench marking is a waste of time given that even the best results won't give more then a 10% gain like for like hardware, hosting and cs-cart setting. And on any given day the 10% gain, even if you do get it, can be and will be wiped out for any number of reasons you can do nothing about.

Its way more than a 10% gain. Its a difference of loading pages in seconds or fractions of seconds. Mind that the Nielsen has researched that customers start leaving if a page takes longer than 1 second to load. And thats what CS-Cart still does. Even after the amazing and very welcome improvement we have with 4.3.

The main speed improvement comes from litespeed cache or ESI. It also allows you to use usergroups. So that your logged in customers are treated differently than guests.



All guests get the same static cache which is refreshed every minute or so (depends on your settings) So database queries are extremely reduced. For example: if you have 1000 users online then normally they would query the database for every page load and in-page data request. So thats 1000 times the same queries. If 90% of those users are guests and it would be cached with LSWS cache then the queries of 900 of those users would be treated as 1 single user. That's a massive difference.

Well sorry but if that's what Nielsen say then they don't know what they are talking about. Sheer logic says that if you go shopping you at least want to look at the goods and so to suggest people wouldn't wait one second is just a daft comment. There own ISP connection could amount for far more then that. You can only affect what you can control hence my 10% comment. No web site loads at the same pace everytime all we can do is do our best.



Naturally a lot depends on the traffic your site attracts but very quickly then you move away from single server configuration and thats what I thought we were discussing here.

[quote name='P-Pharma' timestamp='1430658614' post='213257']

Basically what it boils down to is that NGINX and LSWS are pretty on par with each other in terms of performance. LSWS has the benefit that its much easier to configure and has a lot of extra functions. For a very technical webmaster NGINX can be more appealing.



Based on these independent benchmarks we became interested in litespeed years ago. To see if it would as well for us, we did our own benchmarks to see the difference between Apache and LSWS. The difference was amazing. It was one of the best decisions ever to move to LiteSpeed. It saves us a lot of money in hosting costs and our websites are much faster do to litespeed cache. Except CS-Cart that is.

[/quote]



[font=Arial, sans-serif]I'm not sure that[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]LS[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]performs better than[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]NGINX.[/font][font=Arial, sans-serif] Anyway[/font][font=Arial, sans-serif], [/font][font=Arial, sans-serif]the[/font][font=Arial, sans-serif] CS-Cart team[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]should conduct[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]independent[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]tests to dispel the doubts[/font][font=Arial, sans-serif]. [/font][font=Arial, sans-serif]Probably[/font][font=Arial, sans-serif], [/font][font=Arial, sans-serif]I'm[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]mistaken.[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]However, there is no[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]point in continuing[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]to argue about this[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]in this thread.[/font]

Isn't speed all about the end result? These results are using nginx, and eaccelerator. Cs- 2.24

nginx.JPG

[quote name='kickoff3pm' timestamp='1430669922' post='213265']

Well sorry but if that's what Nielsen say then they don't know what they are talking about. Sheer logic says that if you go shopping you at least want to look at the goods and so to suggest people wouldn't wait one second is just a daft comment. There own ISP connection could amount for far more then that. You can only affect what you can control hence my 10% comment. No web site loads at the same pace everytime all we can do is do our best.



Naturally a lot depends on the traffic your site attracts but very quickly then you move away from single server configuration and thats what I thought we were discussing here.

[/quote]



agreed, too much paranoia about speed, after a certain amount minimal gains count for nothing

[quote name='jackyboy' timestamp='1430675739' post='213270']

Isn't speed all about the end result? These results are using nginx, and eaccelerator. Cs- 2.24

[/quote]



Well if you are creating a site for people who sit on that site and produce speed reports you should be happy. In the real world they mean almost nothing. Your customers will arrive from all sorts of places, using all sorts of methods and landing mostly on inside pages. They'll also have many different intentions for doing that and for most sites it won't be their first visit so your speed testing for a very very limited target. Not saying these site don't have value but for example if one page on your site loads very slow and thats the one with the best vistor count to earnings then you'll never realise that from those reporting sites.

So, I did all that, with nginx. Still only got 3 seconds on the front page. I might have to turn file caching on in nginx.



[attachment=9495:SPEED TEST.PNG]

SPEED TEST.PNG

[quote name='kogi' timestamp='1430808359' post='213407']

So, I did all that, with nginx. Still only got 3 seconds on the front page. I might have to turn file caching on in nginx.



[attachment=9495:SPEED TEST.PNG]

[/quote]

[font=Arial, sans-serif]What version of[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]CS-Cart[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]are you using?[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]How many[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]products and categories on your store[/font][font=Arial, sans-serif]? [/font]Could you provide specifications of the server [font=Arial, sans-serif]([/font][font=Arial, sans-serif]CPU, RAM,[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]Storage)[/font]?

[quote name='kogi' timestamp='1430808359' post='213407']

So, I did all that, with nginx. Still only got 3 seconds on the front page. I might have to turn file caching on in nginx.



[attachment=9495:SPEED TEST.PNG]

[/quote]



I get that result without nginx or doing anything special. A:95 B:89

[quote name='goncharov' timestamp='1430827492' post='213458']



[font=Arial, sans-serif]What version of[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]CS-Cart[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]are you using?[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]How many[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]products and categories on your store[/font][font=Arial, sans-serif]? [/font]Could you provide specifications of the server [font=Arial, sans-serif]([/font][font=Arial, sans-serif]CPU, RAM,[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]Storage)[/font]?

[/quote]



Cscart. Latest

Vps

4cpu / 2gb ram

Demo database

[quote name='kickoff3pm' timestamp='1430851168' post='213500']





I get that result without nginx or doing anything special. A:95 B:89

[/quote]



It's more about the Ttfb and pageload times. Cs demo server serves up a page in 2 seconds

Hey goncharov



Slight Problem with the config file, but it's got me stumped



location /app/ {
deny all;
location ^~ /app/addons/rus_exim_1c/exim_1c.php {
allow all;
}
}




I can still access php files in the /app/ subdirectories

Should it be?


location ^~ /app/ {








Also location /var/skins_repository/ should be /var/themes_repository/

Hey goncharov



The Watermark addon has some rules for Apache to protect the original images. How to translate it for Nginx?

[quote name='kogi' timestamp='1430915237' post='213556']

Hey goncharov



Slight Problem with the config file, but it's got me stumped

[/quote]



[font=Arial, sans-serif]I[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]refactored[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]the configuration. Please, l[/font][font=Arial, sans-serif]et me know[/font][font=Arial, sans-serif] [/font][font=Arial, sans-serif]about the errors. [/font]

[font=Arial, sans-serif]Important: storefronts in the subdirectories does not work.[/font]



server {
listen 80;
server_name _;

charset utf-8;
set $root "/var/www/html";

access_log /var/log/nginx/access.log combined;
error_log /var/log/nginx/error.log;

gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types text/plain application/xml
application/javascript
text/css
text/js
text/xml
application/x-javascript
text/javascript
application/json
application/xml+rss;

client_max_body_size 100m;
client_body_buffer_size 128k;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
client_header_buffer_size 1k;
large_client_header_buffers 4 16k;

error_page 598 = @backend;

location @backend {
root $root;
proxy_read_timeout 61;
fastcgi_read_timeout 61;
try_files $uri $uri/ =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

location / {
if (-f $root/maintenance) {
return 503;
}
root $root;
index index.php index.html index.htm;
rewrite ^/api/(.*)$ /api.php?_d=$1&ajax_custom=1&$args last;
try_files $uri $uri/ @fallback;
}

location @fallback {
rewrite ^(.*)$ /index.php?$args last;
}

location ~* \.(jpeg|ico|jpg|gif|png|css|js|pdf|txt|tar|wof|csv|zip) {
access_log off;
try_files $uri @statics;
expires 14d;
add_header Access-Control-Allow-Origin *;
add_header Cache-Control public;
root /var/www/html;
}

location @statics {
rewrite ^/(\w+)/(.*)$ /$2 break;
access_log off;
rewrite_log off;
expires 14d;
add_header Cache-Control public;
add_header Access-Control-Allow-Origin *;
root /var/www/html;
}

location ~ /(index|admin|api).php {
return 598;
}

location = /install/index.php {
return 598;
}

location ^~ /app/ {
return 404;
location = /app/addons/rus_exim_1c/exim_1c.php {
return 598;
}
}

location ^~ /app/payments/ {
return 404;
location ~ \.php$ {
return 598;
}
}

location ^~ /var/database/ {
return 404;
}

location ~* \.([pP][hH][pP]|[tT][pP][lL].?)$ {
return 404;
}

location ~ /\.(ht|git) {
return 404;
}
}