1

I just found Nginx and I am currently looking for some feedback & Improvements on my configuration to be ran in an "production environment"

The server is runing Windows server 2008 r2 with a Core 2 duo e8500 (2 cores) and ~4 GB ram behind a pfSense Firewall +dhcp.

I am using MariaDB 10.0.1 and Php 7.0.5.

99% of my sites will be using Laravel 5.2+, the other % is PhpMyAdmin. Traffic will be avarage

Here is my configuration:

#  2 * Number of CPUs (http://stackoverflow.com/questions/7325211/tuning-nginx-worker-process-to-obtain-100k-hits-per-min)
worker_processes 2;
# 2 * worker_connections

#SET PHP_FCGI_MAX_REQUESTS=0 i env variables är satt.

error_log off;

events {
    # * 2 number of cpus
    worker_connections  19000;
    #Denna e ny sedan stable
    multi_accept on; 
}
worker_rlimit_nofile    20000; 

http {
    include       mime.types;
    # kolla detta
    default_type text/plain; #application/octet-stream
    #connection_pool_size = 512;

    charset utf-8;
    # Logging
    access_log off;

    # Default storlek på sidan
    client_max_body_size 2m;

    sendfile           on;
    tcp_nopush         on;
    tcp_nodelay        on;

    keepalive_timeout  65;
    gzip  on;
    gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;


    #include fastcgi_params;
    #Default fastcgi
    fastcgi_index index.php;
        fastcgi_intercept_errors off;
        fastcgi_buffers 32 32k;
        fastcgi_buffer_size 32k;
    fastcgi_read_timeout 300;
    #fastcgi_keep_conn on; #Experiment
    include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    #default annat
    index index.html index.htm index.php;


# My servers
server {
    listen 80;
    server_name phpmyadmin.example.org;
    root c:/web/www/phpmyadmin;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }

    # För phpmyadmin databas- dump
    client_max_body_size 100m;

    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
    }

    location ~ /\.ht {
        deny all;
    }
}

server {
    listen 80;
    server_name www.example.org example.org;
    root c:/web/www/example.org/public;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }


    location ~ \.php$ {
    #For Laravel
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass 127.0.0.1:9001;
    }

    location ~ /\.ht {
        deny all;
    }
}

server {
    listen 80;
    server_name laravel.example.org;
    root c:/web/www/rondo/public;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }


    location ~ \.php$ {
    #For Laravel
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass 127.0.0.1:9002;
    }

    location ~ /\.ht {
        deny all;
    }
}

}

Is there something i can improve? Is there something that just defeats itself in the configuration? Can i adjust / Modify PHP configuration to make things run smoother with Nginx, because if i hold down F5 the site will go down (Other sites not affected, because its php-cgi that is the bottleneck?)

naT erraT
  • 502
  • 1
  • 5
  • 19

0 Answers0