Go Back   vb.org Archive > Community Discussions > Forum and Server Management
  #1  
Old 09-30-2010, 12:16 PM
LuisManson LuisManson is offline
 
Join Date: Jun 2010
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default nginx config help (getting started)

Hi, im just migrating my server to a P3, 2Gb RAM, 500Gb HD. I just became interested on the benefits of nginx/php-fpm over apache and im trying to move to this environment from a FreeBSD/Apache setup

my site has almost 300 users online on top hour...
4K visits/day
400K page views/day
1M hits/day
4Gb transfered/day

i need some exmaple config files of a working site or an optimized config, since im an apache/mod_php guy im reaaaaly lost here...

thanks!
Reply With Quote
  #2  
Old 10-01-2010, 11:14 PM
Liquid1ce's Avatar
Liquid1ce Liquid1ce is offline
 
Join Date: Feb 2004
Location: /root
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you can try this

nginx.conf
events {
worker_connections 6000;
}
worker_processes 12;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 10;
gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

php-fpm.conf
<value name="max_children">3000</value>
<value name="StartServers">200</value>
<value name="MinSpareServers">600</value>
<value name="MaxSpareServers">2000</value>
<value name="request_terminate_timeout">10s</value>
Reply With Quote
  #3  
Old 10-02-2010, 05:48 PM
LuisManson LuisManson is offline
 
Join Date: Jun 2010
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

good, thanks!!!
Reply With Quote
  #4  
Old 10-03-2010, 01:04 PM
snakes1100 snakes1100 is offline
 
Join Date: Dec 2001
Location: Michigan
Posts: 3,733
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

With 300 people online at your peak time, there is no reason to start nginx or php-fpm with that many connections, there is no way you will use them, they are also going to use resources better spent in other places.

Start them off with their default connection limits in place, consider raising them if your traffic increases.

You should adjust these values based on your sites traffic & content, NOT by what others are using, these values should reflect your needs.

Basic optimized configuration:
Code:
client_header_timeout           10m;
        client_body_timeout             10m;
        send_timeout                    10m;
        client_max_body_size            10m;
        client_body_buffer_size         10m;
        connection_pool_size            256;
        client_header_buffer_size       8k;
        large_client_header_buffers     4 32k;
        request_pool_size               8k;

        gzip                            on;
        gzip_min_length                 1100;
        gzip_buffers                    8 16k;
        gzip_comp_level                 1;
        gzip_types                      text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
        gzip_disable                    "MSIE [1-6]\.";

        output_buffers                  1 32k;
        postpone_output                 1460;

        sendfile                        on;
        tcp_nopush                      on;
        tcp_nodelay                     on;

        server_names_hash_max_size      4096;
        server_names_hash_bucket_size   128;

        keepalive_timeout               75 20;

        ignore_invalid_headers          on;

        fastcgi_connect_timeout         60;
        fastcgi_send_timeout            180;
        fastcgi_read_timeout            180;
        fastcgi_buffer_size             8k;
        fastcgi_buffers                 4 128k;
        fastcgi_busy_buffers_size       256k;
        fastcgi_temp_file_write_size    256k;
        fastcgi_intercept_errors        on;
        index                           index.php;

        proxy_buffering                 on;
        proxy_buffer_size               4k;
        proxy_buffers                   8 32k;
The above is for a site pumping a lot of content, with a lot of ads, with multiple sites hosted, in the header etc, again base these settings off your site.

With 2500 online:
Code:
nginx.conf
worker_processes                        8; <-- 1 per core
worker_rlimit_nofile                    4096;

events {
                                        worker_connections 1024;
                                        use epoll;
}


php-fpm.conf
listen.backlog = -1
pm = dynamic
pm.max_children = 50
pm.start_servers = 15
pm.min_spare_servers = 10
pm.max_spare_servers = 25
pm.max_requests = 500
With 4000 online, different server/forum
Code:
nginx.conf
worker_processes                        16; <-- 1 per core
worker_rlimit_nofile                    4096;

events {
                                        worker_connections 2048;
                                        use epoll;
}


php-fpm.conf
listen.backlog = -1
pm = dynamic
pm.max_children = 10
pm.start_servers = 35
pm.min_spare_servers = 15
pm.max_spare_servers = 50
pm.max_requests = 1024
Reply With Quote
  #5  
Old 10-04-2010, 09:16 AM
Angel-Wings's Avatar
Angel-Wings Angel-Wings is offline
 
Join Date: Sep 2007
Posts: 206
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by LuisManson View Post
I just became interested on the benefits of nginx/php-fpm over apache and im trying to move to this environment from a FreeBSD/Apache setup
And do these benefits exactly match your existing setup and configuration and usage data that there's a real benefit ?

Without any usage datas and building a configuration upon these matching exactly the needs there won't be much speedup by changing some software.
Reply With Quote
  #6  
Old 10-04-2010, 11:02 AM
LuisManson LuisManson is offline
 
Join Date: Jun 2010
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thank you very much snakes1100 , i will definitely go to try to use something from that info!!!


Angel-Wings: im not sure, but if i dont try how do i know if its better?
Yet, my new hardware is a bit smaller, so i think this will be an improvement some how, i lost a bit on hardware now, but i also migrate to a lighter software

about my usage data, what do you ask specifically?
i obviously wont just copy/paste the examples posted here, since everyone has different needs, but i needed a starting base
Reply With Quote
  #7  
Old 10-04-2010, 01:01 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As per this forums Forum & Server Management posting guidelines this question should have been asked on vBulletin.com:
Quote:
Topics that do not fit this forum:

General PHP/MySQL/webserver configuration.

Please use vBulletin.com to get suggestions on your servers configuration on the topic of general PHP/MySQL optimisation. On the vBulletin.com Server Configuration you will get suggestions by one of our Support Professionals.
Reply With Quote
  #8  
Old 10-04-2010, 01:37 PM
LuisManson LuisManson is offline
 
Join Date: Jun 2010
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks Marco, im actually interested on real work config examples, not sure if support also has own boards with vb and different environments
Reply With Quote
  #9  
Old 10-04-2010, 02:21 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Both Eva2000 (official support) and other users may respond in that forum. Eva2000 (George) is very experienced in running many different environments.

Bottom line is that it is better to have such specialized information in a single place.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:19 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07101 seconds
  • Memory Usage 2,244KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete