Wednesday, 23 November 2016

Instalasi Bank Soal di NGINX

Status : Draft


Konfigurasi NGINX



server {
        #listen 80 default_server;
        #listen 443 ssl;

        server_name banksoal.np;
        #ssl_certificate /etc/nginx/ssl/nginx.crt;
        #ssl_certificate_key /etc/nginx/ssl/nginx.key;

#tuning: https://www.monitis.com/blog/6-best-practices-for-optimizing-your-nginx-      performance/

worker_processes 8;
worker_connections 1024;
gzip on;
gzip_proxied any;
gzip_types text/plain text/xml text/css application/x-javascript;
gzip_vary on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
access_log off;


        root /opt/www/banksoal/application/webroot;

     
        error_log /var/log/nginx/banksoal/error.log;

        fastcgi_read_timeout 25920000s;
client_max_body_size 500M;

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

        location ~ [^/]\.php(/|$) {
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;
                if (!-f $document_root$fastcgi_script_name) {
                        return 404;
                }
                include fastcgi_params;
                fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param   PATH_INFO               $fastcgi_path_info;
                fastcgi_param   KOHANA_ENV PRODUCTION;
                fastcgi_pass fpm73;
        }
}

/etc/nginx/conf.d/fpm.conf

upstream fpm {
        server unix:/run/php/php7.0-fpm.sock;
}

 /etc/php/7.0/fpm/php.ini

upload_max_filesize = 500M
post_max_size = 500M
memory_limit = ..sesuaikan dgn memory yg tersedia, lebih besar lebih baik..

 /etc/php/7.0/fpm/pool.d/www.conf 

pm.max_children = 40
pm.start_serveres = 15
pm.min_spare_servers = 15
pm.max_spare_servers = 25

Untuk konfigurasi yg lebih tepat bisa baca : https://dev.to/jake/configuring-php-fpm-for-high-network-traffic-47le