Monthly Archive: November 2013

How to search inside files in linux 0

How to search inside files in linux

To search within files we can use the command grep (man grep). Basic usage is as follows:

grep -Ril "mail" /var/www/

This will search our web root folder (/var/www/) for any text with the word ‘mail’ inside it.

  • R – Recursive
  • i – uppercase/lowercase
  • l –  Show file name instead of actual location
How to enable .htaccess in apache 0

How to enable .htaccess in apache

Step 1.

cd /etc/apache2/sites-available

Step 2.

vim default (or default-css)

Step 3. Change AllowOverride from ‘None’ to ‘All’

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    <Directory />
            Options FollowSymLinks
            AllowOverride All    <---- replace None with All
    </Directory>
    <Directory /var/www >
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All   <---  replace None with All
            Order allow,deny
            allow from all
    </Directory>

Step 4. Enable Mod Rewrite

sudo a2enmod rewrite

5. Restart Apache

service apache2 restart

You are now done…

Sample .htaccess…

(more…)

List of AD networks and CPM Rates (ongoing) 0

List of AD networks and CPM Rates (ongoing)

These are the rates for an average entertainment site with 300×250 banner ads.

Network Name eCPM Other Notes Fill P
 ValueClick  $0.75  You get to pick your own ads and high fill rate. Awesome Tier 1 Ad Network  15%  Y
PulsePoint $1.00 As you get to choose your own rate. The eCPM can Potentially be higher or lower but I’ve found this to be the best to get a reasonable fill rate 25% Y
Lijit $0.40 Lijit has Separate Rates for US traffic and ‘International’ Traffic. Noted here is US. By default, International CPM and fill rte is slightly lower 80% Y
 Yllix  $0.03  Extremely poor fillrate as well as low CPM. Fail to see why anyone would use them.  5% N
Copacet  N/A  CPC
 CPMFun $0.05  Impressive fill rate but the low CPM makes it not worth your time. 70% N
 CPM Go  $0.30  Above average eCPM and relatively good fill rate. Definitely one of the more impressive underdogs in the ad network world.  50%  Y

T* – > Traffic Utilization (how much of traffic sent to network was actually used)
P -> Passback tags (Y – Yes :  N – No)
E. eCPM* -> Effective Passback tags, CPM rate when T* is taken into account ( do not use literally is completely inaccurate if ad network uses Passback tags)

More data is always appreciated as this is an ongoing list. Seek me out in the comments if you have anything you wish to share

How to setup a Nginx Server (LEMP Stack) 0

How to setup a Nginx Server (LEMP Stack)

nginx-logo

Setup an Ubuntu Server with only the

  • [x] Essential Services
  • [x] SSH Server

Login as root

Lets start with an update

apt-get update
apt-get upgrade

To secure your server a bit. Edit ssh and change the default port

nano /etc/ssh/sshd_config

Change ‘port 22’ to whatever port you wish to use then…

service ssh reload

(you can now login like this:  ssh root@ur.server.ip.ip -p portyouchose )

We now begin setting up the actual server components starting with MySQL

apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

(you will be prompted to enter your password here: lets call that passwordA)

Now MySQL is installed lets configure for production use.

mysql_install_db
/usr/bin/mysql_secure_installation

It my ask for the root password: enter passwordA which you entered above.
Do you want to change password: N
Remove Anonymous Users: Y
Disallow Root Login Remotely: Y
Remove test Database: Y
Reload Tables: Y

All done!! At Least with MySQL

During the installation of MySQL an apache server may have been setup.. since we want LEMP (we need to uninstall apache2 and install Nginx) do that with

(uninstall apache)

service apache2 stop
apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
apt-get autoremove

(install Nginx)

apt-get install nginx
service nginx start

(you can do a ‘ifconfig’ to get ip address and test out server in your browser)

On to the last part. Installing PHP.

apt-get install php5-fpm

And configure it..

Open php.ini

vim /etc/php5/fpm/php.ini # you may use nano if u wish (nano /etc/php...)

find ‘cgi.fix_pathinfo=1’ and replace with ‘cgi.fix_pathinfo=0’ – this makes PHP not ‘guess’ what urls users are trying to go to (added security)

and restart php

service php5-fpm restart

Well.. thats about it.. your html files are at /usr/share/nginx/www

For added security you can install denyhosts

apt-get install denyhosts

and phpmyadmin

apt-get install phpmyadmin

 

Enjoy your new high performance and secure Nginx server.