Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Recently bought server


Installed Ubuntu 13.10, nginx webserver, php-fpm. It's for large auditory website. Now I'm bit confused about PHP-FPM pool configuration and nginx website configuration. My PHP-FPM pool looks like that:

My PHP-FPM pool settings look like (I removed all comments from file, and changed projects actual name with website)


listen = /var/run/website_fpm.sock

listen.owner = website
listen.group = website
listen.mode = 0660

user = website
group = website

pm = dynamic
pm.max_children = 300
pm.start_servers = 100
pm.min_spare_servers = 200
pm.max_spare_servers = 300
pm.max_requests = 500

chdir = /

php_admin_value[session.save_path] = "/home/website/_sessions"
php_admin_value[open_basedir] = "/home/website:/usr/share/pear:/usr/share/php:/tmp:/usr/local/lib/php"

In PHP.ini changed only memory limit:

memory_limit = 49000M

And here is how NGINX conf:

server {
  server_name website.com www.website.com;
  root "/home/website/public_html";

  index index.php index.html index.htm;
  client_max_body_size 10m;

    access_log /home/website/_logs/access.log;
    error_log /home/website/_logs/error.log;

    if ($http_user_agent ~* (Baiduspider|webalta|nikto|wkito|pikto|scan|acunetix|morfeus|webcollage|youdao) ) {
       return 401;

    if ($http_user_agent ~* (HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) ) {
       return 401;

    location / {
            try_files $uri $uri/ /index.php$uri?$args;

    location ~ "^(.+\.php)($|/)" {
        fastcgi_split_path_info ^(.+\.php)(.*)$;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param SERVER_NAME $host;

        if ($uri !~ "^/uploads/") {
            fastcgi_pass   unix:/var/run/website_fpm.sock;
        include        fastcgi_params;

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
            expires max;
            log_not_found off;
            access_log off;

    location ~* \.(html|htm)$ {
        expires 30m;

    location ~* /\.(ht|git|svn) {
        deny  all;

Please modify based on server parameters that I provided. I need expert advise for configuring this server for large audience.

share|improve this question
Hey did you find any good resources for optimising nginx yet? Would you mind sharing what you went with and your experience? –  Freeze Dried Pop Jul 12 '14 at 9:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.