Wednesday 27 June 2018

Nginx warning - A client request body is buffered to a temporary file /var/cache/nginx/client_temp/


Today I saw a unknown warning error on the Nginx server that it happens when i was trying to upload a file to a website, checking the logs I found this error "A client request body is buffered to a temporary file "

This is my log file:
2018/06/27 12:27:38 [warn] 20230#20230: *743 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000000007, client: 10.177.6.42, server: 10.177.6.45, request: "POST /creation/upload/component/9656/video/ HTTP/1.1", host: "10.177.6.45", referrer: "http://10.177.6.45/creation/upload/component/9656/video/"

 

Solution :

 

While investigating this, I found that the size of the uploaded file is larger than memory buffer set for my file uploads.

After that I changed the "client_body_buffer_size" variable value in Nginx configuration file

[root@server ]# vim /etc/nginx/conf.d/default.conf

client_body_buffer_size 100M;

Then restart the nginx service

[root@server ]# service nginx restart
Stopping nginx:                                            [  OK  ]
Starting nginx:                                            [  OK  ]

[root@server]#


My issue is resolved.

Monday 18 June 2018

Working with Ansible

Consider the following terms while using Ansible.

Control Node
   
 Control host is a machine where we have installed the Ansible. This control host controls all remote nodes.

Managed hosts
    Remote nodes are named as managed hosts.

Inventory file
    This is the default ansible 'hosts' file. It is a collection of nodes with related datas and grouping that ansible can connect and manage.

Prerequisite:


1. Setup ssh key-based authentication. (Ansible is a agent-less tool and use SSH protocol to deploy modules on managed hosts.)

2. Install python on managed hosts

Setup ssh key-based authentication

Generate ssh key



copy ssh key file to managed hosts



checking auto login from control node to remote nodes.




Adding managed hosts in Inventory file

[root@sysads ~]# vim /etc/ansible/hosts

[servers]
10.177.6.249


Testing with ansible modules



Sunday 10 June 2018

Session Expired, Please login again when using Adminer


I was trying to access the database using adminer.php but I could not able to login, even though I filled in the correct credentials.




The log file gave me the exact issue.

[root@beta-server ]# cat /var/log/nginx/error.log

[error] 24318#24318: *46 FastCGI sent in stderr: "PHP message: PHP Warning:  Unknown: open(/var/lib/php/session/sess_0c6qn562knk0fm7vkil358kr80, O_RDWR) failed: Permission denied (13) in Unknown on line 0
PHP message: PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0" while reading upstream, client: 10.130.12.45, server: example.com, request: "GET /?username=root HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-fpm.sock:", host: "example.com", referrer: "http://example.com/?username=root"




Solution



These errors occur because PHP has no way of saving sessions on disk.

The location of the PHP session path can be found in "/etc/php.ini" under session.save_path. The default path is /var/lib/php/session. If this directory does not exist, then create it and change permissions on it.

[root@beta-server ]# chmod -R 700 /var/lib/php/session
[root@beta-server ]# chown nginx.nginx -R /var/lib/php/session

After all these changes, i can able to login successfully.


Wednesday 6 June 2018

Install Ansible on Ubuntu 16.04

Ansible is a IT automation, configuration management tool to manage the infrastructure. For more information click here
 
For installing Ansible you have to configure PPA on your machine.For this,you have to run the following commands

root@manivel:~# apt-add-repository ppa:ansible/ansible

 Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications— automate in a language that approaches plain English, using SSH, with no agents to install on remote systems.

http://ansible.com/
 More info: https://launchpad.net/~ansible/+archive/ubuntu/ansible
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmp7y79v8_4/secring.gpg' created
gpg: keyring `/tmp/tmp7y79v8_4/pubring.gpg' created
gpg: requesting key 7BB9C367 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp7y79v8_4/trustdb.gpg: trustdb created
gpg: key 7BB9C367: public key "Launchpad PPA for Ansible, Inc." imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK



root@manivel:~# apt-get update

root@manivel:~# apt-get install ansible


For checking Ansible version you have to run the following command

root@manivel:~# ansible --version

ansible 2.5.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/manivel/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.12 (default, Nov 20 2017, 18:23:56) [GCC 5.4.0 20160609]


Friday 1 June 2018

Open a .vmdk file in VirtualBox


Let see here how to open a .vmdk file in VirtualBox.

First Open the VirtualBox application and click  "NEW" button to create new virtual machine.




Choose a descriptive name of the new virtual machine and  Select the type of operating system.
Then click "Next".




Select the amount of RAM memory and Click "Next".





This step you have to choose below things,
1. Choose "use an existing virtual hard disk file"
2.  Choose a virtual hard disk file





Choose a .vmdk file and click open.



Click "Create" button



Now you can see that your .vmdk file imported successfully on VirtualBox.