Skip to content

Instantly share code, notes, and snippets.

View amolkhanorkar's full-sized avatar

Amol Khanorkar amolkhanorkar

View GitHub Profile
@amolkhanorkar
amolkhanorkar / Nginx + Passenger + Ubuntu init script
Last active August 29, 2015 14:04
Nginx + Passenger + Ubuntu init script
Here is the init script for Nginx while we are going to use with Phusion Passenger on ubuntu. I have used it on Ubuntu 12.04 LTS.
Create a file "/etc/init.d/nignx" and add below code into it.
vim /etc/init.d/nignx
Then add nginx into update-rc.d for start nginx whenever system boot,
update-rc.d nginx defaults
Make that file executable by changing permission,
chmod +x /etc/init.d/nignx
@amolkhanorkar
amolkhanorkar / Installing Oracle Instaclient with OCI8 drivers for PHP application.
Created April 28, 2014 14:22
Installing Oracle Instaclient with OCI8 drivers for PHP application.
Introduction
Contents
Introduction
Install RPMs
Integrate Oracle Libraries
ORACLE_HOME
SDK fix
Oracle Instant Client is a free Oracle database client. The current version is 11.2.0.1.0, and several versions back to 10.1.0.5 are available.
@amolkhanorkar
amolkhanorkar / Postgresql Database Backup & Restore
Last active August 29, 2015 14:00
Postgresql Database Backup & Restore
First take dump using this method
Dump schema of database:
pg_dump -Fp -s -v -f abc-schema.sql -U postgres dbname
Dump contents of database:
pg_dump -Fc -v -f abc-full.dump -U postgres dbname
Then restore using this methodology
@amolkhanorkar
amolkhanorkar / Convert openssl .key file to .pem
Created April 10, 2014 12:12
Convert openssl .key file to .pem
For converting .key file to .pem file,
Your keys may already be in PEM format, but just named with .crt or .key.
If they begin with -----BEGIN and you can read them in a text editor (they use base64, which is readable in ASCII, not binary format), they are in PEM format.
If the file is in binary, for the server.crt, you would use
openssl x509 -inform DER -outform PEM -in server.crt -out server.crt.pem
For server.key, use openssl rsa in place of openssl x509.
@amolkhanorkar
amolkhanorkar / Convert openssl .crt file to .pem
Created April 10, 2014 12:10
Convert openssl .crt file to .pem
For converting .crt file to .pem
openssl x509 -in mycert.crt -out mycert.der -outform DER
You would then take the output of that, (i.e. mycert.der) and call:
openssl x509 -in mycert.der -inform DER -out mycert.pem -outform PEM
Setup PHP different framework on Nginx
To install PHP-FPM with nginx please follow the below link
https://sites.google.com/a/weboniselab.com/webonisers/devops/nginx-setup
Setup Cake PHP with nginx
1. Download Cake PHP from : https://github.com/cakephp/cakephp/zipball/2.4.6
2. Extract it at /var/www/<app-name>
3. Create Nginx conf file
server {
listen 80;
Nginx setup
Install Required Packages (Pre-requisite php & project required directory should be installed)
apt-get update
apt-get upgrade
apt-get install nginx php5-cli php5-cgi spawn-fcgi
Now we will do the fastcgi configuration with nginx. In this we are going to use tcp socket base communication.
i. Start fastcgi deamon
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/php-cgi.pid -C 6
ii. You can use below script to start fastcgi process
How To Monitor Remote Linux Host using Nagios 3.0
I explained the overview, installation and configuration of Nagios 3.0 on Red Hat Server.I’ll explain how to monitor a remote Linux host and the various services running on the remote host.  Also, please refer to all Nagios articles.
 
I. Overview
II. 6 steps to install Nagios plugin and NRPE on remote host.
1. Download Nagios Plugins and NRPE Add-on
2. Create nagios account
3. Install Nagios Plugins
4. Install NRPE
5. Setup NRPE to run as daemon
@amolkhanorkar
amolkhanorkar / Glassfish setup
Created March 12, 2014 08:43
Glassfish setup
Glassfish setup
Make sure you have at least 512 memory free!
1.) Install java
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
2.) Get GlassFish ZIP file
@amolkhanorkar
amolkhanorkar / Deploy app on glassfish by creating virtual server
Created March 12, 2014 06:34
Deploy app on glassfish by creating virtual server
Deploy App(war) in Glassfish & run through virtual server
open glassfish admin console
http://<server-ip>:<admin-port>
eg http://192.168.10.1:4848
Set environment for domain
Goto Enterprise server/Server admin -> System properties tab -> click Add propertie
Enter: Name=environment, value=testing/development
Deploy war file
- Goto -> Application -> click on deploy