Check which mpm (multi processing module) apache is running prefork worker or mpm

In Ubuntu 14.04 apache2.4

a2query -M
 
Tells event, prefork, worker
You can change it by adding symbolic links for mpm_<chosen> from mods-available to mods-enabled in /etc/apache2.
Only one is allowed in a time.


#source /etc/apache2/envvars
#apache2 -V | grep -i "server mpm"

#httpd -V | grep -i "server mpm"



set environment or enviroment variable linux

https://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-files-loading-order-bashrc-zshrc-etc/


  1. /etc/environment This is the best place for variables that are system-wide. This includes extending variable PATH with paths from /usr/local or for JAVA_HOME Do not use export here or duplicate definitions. 
  2. /etc/xprofile Very little known but very useful for everyone who uses X window system. This is executed for every user that logs into X. It is very good choice for values that are valid for every user like /usr/local. Documentation.
  3. /etc/profile and /etc/profile.d/* This is a good choice for non X systems but bad for X ones. Those files are read only by shells.
  4. /etc/<shell>.<shell>rc. This is not a good choice because it is single shell specific. Also forget about X.
  5. ~/.xprofile The same as 2. This is executed when the user logs into X. The variables defined here are visible to every X application. A very good place for extending PATH with values such as ~/bin or ~/gocode/bin or defining user specific GOPATH. Your graphical text editor or IDE started by shortcut will see those values. Documentation.
  6. ~/.profile It will be visible only for programs started from terminal or terminal emulator. It is a good choice for systems where you do not use X window system.
  7. ~/.<shell>rc. This is not a good choice because it is single shell specific.

/bin/bash
       The bash executable
/etc/profile
       The systemwide initialization file, executed for login shells
~/.bash_profile
       The personal initialization file, executed for login shells
~/.bashrc
       The individual per-interactive-shell startup file
~/.bash_logout
       The individual login shell cleanup file, executed when a login shell exits
~/.inputrc
       Individual readline initialization file
 
If you have ever put something in a file like .bashrc and had it not work, or are confused by why there are so many different files — .bashrc, .bash_profile, .bash_login, .profile etc. — and what they do, this is for you.
The issue is that Bash sources from a different file based on what kind of shell it thinks it is in. For an “interactive non-login shell”, it reads .bashrc, but for an “interactive login shell” it reads from the first of .bash_profile, .bash_login and .profile (only). There is no sane reason why this should be so; it’s just historical. Follows in more detail.
For Bash, they work as follows. Read down the appropriate column. Executes A, then B, then C, etc. The B1, B2, B3 means it executes only the first of those files found.



 
 


setup git server ubuntu 14.04 lts

install git on both gitserver and client

ssh-copy-id the publickey from client to server
mkdir -p /files/webdir.git
cd /files/webdir.git
git init --bare
chown -R gituser:gituser /files/

##On client-A

git config --global user.name "Joe blog"
git config --global user.email "joe@example.com"

we create our local git repo on /developer/djangoproject

mkdir -p /developer/djangoproject
cd /developer/djangoproject
git init .
git remote add origin root@gitserver:/files/webdir.git

to edit >> git remote set-url origin root@gitserver:/files/webdir.git

echo "hello" > index.html
git add .
git commit -m "first commits"

git push origin master

    Counting objects: 3, done.
    Writing objects: 100% (3/3), 212 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    To root@gitserver:/files/webdir.git
    * [new branch]      master -> master

   
### On client-B
git clone root@gitserver:/files/webdir.git OR
git clone root@192.168.100.221:/files/webdir.git




enable ssh root login linux

vim /etc/ssh/sshd_config

#PermitRootLogin without-password

PermitRootLogin yes

enable ssh password authentication

vim /etc/ssh/sshd_config
#place below at end of file

PasswordAuthentication yes

##Enable root login

vim /etc/ssh/sshd_config

#PermitRootLogin without-password
PermitRootLogin yes

perl setting locale failed

root@server:~# /usr/lib/cgi-bin/awstats.pl -config=hottiehunter.com -update
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_PAPER = "ne_NP",
    LC_ADDRESS = "ne_NP",
    LC_MONETARY = "ne_NP",
    LC_NUMERIC = "ne_NP",
    LC_TELEPHONE = "ne_NP",
    LC_IDENTIFICATION = "ne_NP",
    LC_MEASUREMENT = "ne_NP",
    LC_NAME = "ne_NP",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

########## solution ################
http://stackoverflow.com/questions/2499794/how-can-i-fix-a-locale-warning-from-perl

"locale" is a subset of the user's environment that defines the user's language, country and any special variant preferences that the user wants to see in their user interface


locale             << shows locale variables
copy below export commands to ~/.bashrc  file or run below commands

export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_TYPE=en_US.UTF-8

dpkg-reconfigure locales

vim /etc/default/locale

LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8



setup NTP on ubuntu 14.04 for utc timezone

apt-get install ntp ntpdate

apt-get install ntp ntpdate

cat /etc/ntp.conf
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org
server ntp.ubuntu.com
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1


service ntp restart

service cron stop && service cron start

Check ntp stats
================

#ntpq -pn

-p : Print a list of the peers known to the server as well as a summary of their state.
-n : Output all host addresses in dotted-quad numeric format rather than converting to the canonical host names.


# ntpq -pn

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*131.107.13.100  .ACTS.           1 u   39   64  377    6.668   -1.887   2.894
+199.101.100.221 130.207.244.240  2 u   12   64  377   89.209   -8.376   1.750
-129.250.35.251  129.250.36.26    2 u   36   64  377   25.029   -8.342   3.061
+129.6.15.28     .ACTS.           1 u   34   64  377   78.681   -4.869  27.612
-91.189.89.199   170.224.124.217  2 u   40   64  377  141.474   -6.736   2.311


watch command linux

 By default watch command runs a command or script for every two seconds by default, we can increase or decrease the interval by using -n option
minimum is 0.1 second

#watch -n 0.1 -t  lsof -i

-t = supresses the time on top of display

postfix header check

https://www.howtoforge.com/community/threads/howto-spam-control-for-postfix.48608/
http://mattshaw.org/news/how-to-filter-mail-with-postfix-header_checks/

https://posluns.com/guides/header-checks/
https://www.howtoforge.com/community/threads/postfix-header-checks.80/

ispconfig3 setup on debian jessie remove default page setting

https://www.howtoforge.com/tutorial/perfect-server-debian-8-jessie-apache-bind-dovecot-ispconfig-3

+ remove /etc/apache2/sites-enabled/000-default..conf
or echo >  /etc/apache2/sites-enabled/000-default..conf