Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Saturday 22 April 2017

How To Configure Laravel PHP Framework on CentOS/RHEL 6x

How To Configure Laravel PHP Framework on CentOS/RHEL 6x


What is Laravel PHP Framework ?

-- Laravel is a free, open-source PHP Web Framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller (MVC) architectural pattern.

Installation Step :

Step: 1. Set Host Name :

# hostname laravel.oit.com
# vi /etc/sysconfig/network

HOSTNAME=laravel.oit.com

-- Save & Quit (:wq)

Step: 2. Bind Host File :

# vi /etc/hosts

10.100.97.38    laravel.domain.com        laravel

-- Save & Quit (:wq)

Step: 3. Stop Firewall & Disable Selinux :

# service iptables stop
# chkconfig iptables off

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

Step: 4. Install NTP Server For Time Synchronization :

# yum -y install ntp ntpdate
# service ntpd restart
# chkconfig ntpd on
# ntpdate pool.ntp.org

Step: 5. Reboot the System :

# init 6

Step: 6. Install EPEL & Remi Repository :

# yum -y install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Step: 7. Install Apache Server :

# yum -y install --enablerepo=remi,epel httpd httpd-devel

Step: 8. Remove MySQL 5.1 & Install MySQL 5.6 :

# yum -y remove mysql mysql-*

# rpm -Uvh http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
# yum -y install mysql mysql-server

Step: 9. Start MySQL Service & Set Root Password :

# service mysqld restart
# chkconfig mysqld on

# mysql_secure_installation

Step: 10. Install PHP 5.6 :

# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
# yum -y install php56w php56w-common php56w-cli php56w-devel php56w-gd \
    php56w-mysql php56w-mcrypt php56w-mbstring php56w-imap php56w-snmp \
    php56w-xml php56w-xmlrpc php56w-ldap php56w-pdo php56w-json php56w-dom \
    wget unzip curl git openssl

Step: 11. Install Composer :

Note: Composer is required for installing Laravel Dependencies.

# curl -sS https://getcomposer.org/installer | php
# mv composer.phar /usr/local/bin/composer
# chmod +x /usr/local/bin/composer

Step: 12. Install Laravel Framework :

Note: To download latest version of Laravel, Use below command to clone master repo of laravel
               from github.

# cd /var/www/html
# git clone https://github.com/laravel/laravel.git
# cd /var/www/html/laravel
# composer install
# chown -Rf apache.apache /var/www/html/laravel
# chmod -Rf 755 /var/www/html/laravel

Step: 13. Set Encryption Key :

-- Now set the 32 bit long random number encryption key, which used by the Illuminate
      encryption service.

# cd /var/www/html/laravel
# mv .env.example .env
# chown -Rf apache.apache /var/www/html/laravel
# php artisan key:generate

[OUTPUT]
Application key [base64:lNOx1cxl0JWAWX56/Ql6o7/mcw7AVairy1Uqs2XplFo=] set successfully.

-- Update the above Generated Application key into the config/app.php configuration file.
     Also make sure that cipher is set properly.

# vi /var/www/html/laravel/config/app.php

'key' => env('APP_KEY', 'base64:IZ+g3FU+OF1nO4j/4y4EHDdUq4gyJZcJ+weClk3B5Qo='),
'cipher' => 'AES-256-CBC',

-- Save & Quit (:wq)

Step: 14. Create Apache Virtual Host :

# vi /etc/httpd/conf/httpd.conf

-- Add these Lines at Line no 313 :

<Directory /var/www/html/laravel/public>
     Options  -Indexes +Multiviews +FollowSymLinks
        DirectoryIndex index.php index.html
     AllowOverride All
     Allow from all
</Directory>

-- Uncomment Line 996 :

NameVirtualHost *:80

-- Add this Line at the End of the File :

RewriteEngine on

-- Save & Quit (:wq)

# vi /etc/httpd/conf.d/10.100.97.38.conf

<VirtualHost *:80>

  # Admin email, Server Name (domain name) and any aliases
  ServerAdmin techsupport@domain.com
  ServerName 10.100.97.38


  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.php
  DocumentRoot /var/www/html


  # Custom log file locations
  LogLevel warn
  ErrorLog  /logs/10.100.97.38-error_log
  SetEnvIf Request_URI "\.(jpg|xml|png|gif|ico|js|css|swf|js?.|css?.)$" DontLog
  CustomLog /logs/10.100.97.38-access_log combined Env=!DontLog

</VirtualHost>

-- Save & Quit (:wq)

# vi /etc/httpd/conf.d/laravel.domain.com.conf

<VirtualHost *:80>

  # Admin email, Server Name (domain name) and any aliases
  ServerAdmin techsupport@domain.com
  ServerName laravel.domain.com
  ServerAlias www.laravel.domain.com


  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.php
  DocumentRoot /var/www/html/laravel/public


  # Custom log file locations
  LogLevel warn
  ErrorLog  /logs/laravel.domain.com-error_log
  SetEnvIf Request_URI "\.(jpg|xml|png|gif|ico|js|css|swf|js?.|css?.)$" DontLog
  CustomLog /logs/laravel.domain.com-access_log combined Env=!DontLog

</VirtualHost>

-- Save & Quit (:wq)

# mkdir /logs

Step: 15. Start Apache Server :

# service httpd restart
# chkconfig httpd on

http://laravel.domain.com


Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog

 

Sunday 9 April 2017

How To Configure Revive AD Server on CentOS/RHEL 6x

How To Configure Revive AD Server on CentOS/RHEL 6x



What is OpenX Ad Server?

-- OpenX Ad Server is an ad server, created and published by the British-American company OpenX.org. It is a system that can be used to manage and optimize the advertising space on one or more websites. It is a tool for web site owners (called ‘publishers’ in the online advertising industry) but also for organizations running their own ad network. It can even be used by advertisers to manage and measure the ads that they display on their distribution of sites and/or ad networks.

Step: 1. Bind Host File :

# vi /etc/hosts

10.100.97.40    ad.domain.com     ad

-- Save & Quit (:wq)

Step: 2. Disable Selinux & Stop Iptables (This Is For On CentOS/RHEL Server) :

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

# service iptables stop
# chkconfig iptables off

Step: 3. Rebbot the System :

# init 6

Step: 4. Install Apache Server :


# yum -y install httpd httpd-devel wget

Step: 5. Edit httpd.conf file :

# vi /etc/httpd/conf/httpd.conf

#ServerName www.example.com:80

-- Add this Line:

ServerName ip_address_of_server:80

-- Save & Quit (:wq)

Step: 6. Download & Extract Ad Server Package :
 
# cd /var/www/html
# wget http://download.revive-adserver.com/revive-adserver-3.0.2.zip
# unzip revive-adserver-3.0.2.zip
# mv revive-adserver-3.0.2 adserver
# chmod -Rf 775 adserver

Step: 7. Edit the /etc/httpd/conf/httpd.conf File :

# vi /etc/httpd/conf/httpd.conf

Add those Lines :

<Directory /var/www/html/adserver>
    Options -Indexes +Multiviews
       DirectoryIndex index.php index.html
    AllowOverride All
    Allow from all
</Directory>

-- Save & Quit (:wq)

Step: 8. Install MySQL Database Server :

# yum -y install mysql mysql-server

Step: 9. Start Mysqld Service & Set MySQL Root Password :

# service mysqld start
# chkconfig mysqld on

# mysql_secure_installation

-- Press "Enter".
-- Type "Y" & Press "Enter".
-- Give the Root Password & Press "Enter".
-- Type "Y" & Press "Enter".
-- Type "N" & Press "Enter".
-- Type "Y" & Press "Enter".
-- Type "Y" & Press "Enter".

Step: 10. Create Database for Openx :

# mysql -u root -p
Give root Password: redhat

Mysql> create database revivedb character set utf8;
Mysql> grant all privileges on revivedb.* to 'revive'@'localhost' identified by '0p3nx123';
Mysql> flush privileges;
Mysql> exit

Step: 11. Install EPEL Repository :

# yum -y install epel-release

Step: 12. Install PHP5 Scripting Language :

# yum -y install php php-mysql php-common php-cli php-gd php-mbstring php-mcrypt \
    php-devel php-xml php-xmlrpc

Step: 13. Create a file Under "html" Directory for Testing php :

# vi /var/www/html/info.php

<?php
  phpinfo();
?>

-- Save & Quit (:wq)

Step: 14. Restart Apache to load php :

# service httpd restart
# chkconfig httpd on

Step: 15. Then point your Web Browser & Check php :

Ex- http://server_ip_address/info.php

Step: 16. Configure Openx AD Server :

Go to http://server_ip/adserver

-- Check "I Agree".
-- Database Name: revivedb
     Database Username: revive
     Database Password: 0p3nx123
     Database Hostname: localhost
  
-- Click on "Continue".
-- Administrator Username: admin
     Administrator Password: Passw0rd
     Repeat Password: Passw0rd
     Administrator Email Address: kchatterjee@domain.com
     Language: English
     Timezone: GMT+0530 Asia/Culcutta
  
-- Click on "Continue"
-- Click on "Continue".

Step: 17. OpenX Memcached Configuration from Web Interface :

http://Server_ip/adserver/plugin-settings.php?group=oxMemcached

-- Add your memcached server and port if it’s default installation on the same machine add
    localhost:11211 and expiry time of 600 seconds.
-- Click on "Save Changes"

-- Now you need to go in Configuration
-- Banner Delivery Settings and set Time Between Banner Cache Updates to 600 seconds and
     change Banner Delivery Cache Store Type to Memcached.

-- Click on "Save Changes"



Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog

 

Sunday 2 April 2017

How To Configure SuPHP on CentOS/RHEL 6x

How To Configure SuPHP on CentOS/RHEL 6x


Q. What is SuPHP ?

-- SuPHP is an apache module that allows PHP to under a different Linux user than the apache user. This improves the security of hosted websites as you can run the PHP scripts of each website under a different user.

Step: 1. Bind Host File :

# vi /etc/hosts

10.100.97.40    ser4.domain.com     ser4

-- Save & Quit (:wq)

Step: 2. Disable Selinux & Stop Iptables (This Is For On CentOS/RHEL Server) :

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

# service iptables stop
# chkconfig iptables off

Step: 3. Rebbot the System :

# init 6

Step: 4. Install Apache Server :

# yum -y install httpd httpd-devel

Step: 5. Install PHP :

# yum -y install epel-release
# yum -y install php php-cli php-devel php-common php-mbstring php-gd php-xml \
    php-mcrypt php-mysql php-imap php-pdo php-snmp php-soap php-xmlrpc \
    php-opcache php-ldap php-pear php-zip php-curl php-cgi php-fpm wget curl
 
Step: 6. Start Apache Service :

# service httpd restart
# chkconfig httpd on

Step: 7. Install SuPHP & Dependencies :

# yum -y groupinstall 'Development Tools'
# cd /usr/local/src
# wget http://suphp.org/download/suphp-0.7.2.tar.gz
# tar zxvf suphp-0.7.2.tar.gz
# wget -O suphp.patch https://lists.marsching.com/pipermail/suphp/attachments/20130520/74f3ac02/attachment.patch
# patch -Np1 -d suphp-0.7.2 < suphp.patch
# cd suphp-0.7.2
# autoreconf -if
# ./configure --prefix=/usr/ --sysconfdir=/etc/ --with-apr=/usr/bin/apr-1-config \
--with-apache-user=apache --with-setid-mode=owner --with-logfile=/var/log/httpd/suphp_log
# make
# make install

Step: 8. Enabling SuPHP Module in Apache :

# vi /etc/httpd/conf/httpd.conf

-- Add This Line in "LoadModule" Section :

LoadModule suphp_module modules/mod_suphp.so

-- Save & Quit (:wq)

Step: 9. Create SuPHP Config File :


# vi /etc/suphp.conf

[global]
;Path to logfile
logfile=/var/log/httpd/suphp.log
;Loglevel
loglevel=info
;User Apache is running as
webserver_user=apache
;Path all scripts have to be in
docroot=/
;Path to chroot() to before executing script
;chroot=/mychroot
; Security options
allow_file_group_writeable=true
allow_file_others_writeable=false
allow_directory_group_writeable=true
allow_directory_others_writeable=false
;Check wheter script is within DOCUMENT_ROOT
check_vhost_docroot=true
;Send minor error messages to browser
errors_to_browser=false
;PATH environment variable
env_path=/bin:/usr/bin
;Umask to set, specify in octal notation
umask=0077
; Minimum UID
min_uid=100
; Minimum GID
min_gid=100

[handlers]
;Handler for php-scripts
x-httpd-suphp="php:/usr/bin/php-cgi"
;Handler for CGI-scripts
x-suphp-cgi="execute:!self"

-- Save & Quit (:wq)

Step: 10. Start Apache Service :

# service httpd restart
# chkconfig httpd on

Step: 11. Configure an Apache Vhost with SuPHP :


# useradd -s /sbin/nologin web1
# mkdir /var/www/html/example.com
# vi /var/www/html/example.com/info.php

<?php
phpinfo();
?>

-- Save & Quit (:wq)

# chown -Rf web1:web1 /var/www/html/example.com
# vi /etc/httpd/conf.d/example.com.conf

<VirtualHost *:80>
 DocumentRoot /var/www/html/example.com
 ServerName example.com
 ServerAlias www.example.com
 ServerAdmin webmaster@example.com

 <FilesMatch ".+\.ph(p[345]?|t|tml)$">
 SetHandler None
 </FilesMatch>

 <IfModule mod_suphp.c>
 suPHP_Engine on
 <FilesMatch "\.php[345]?$">
 SetHandler x-httpd-suphp
 </FilesMatch>
 suPHP_AddHandler x-httpd-suphp
 </IfModule>
</VirtualHost>

-- Save & Quit (:wq)

# service httpd restart

Step: 12. Test the SuPHP Setup :

http://example.com/info.php

Note: Important is the ServerAPI line which shows CGI/FastCGI. which shows that PHP is run through SuPHP & not mod_php.

# vi /var/www/html/example.com/testuser.php

<?php
echo get_current_user();
?>

-- Save & Quit (:wq)

# chown -Rf web1:web1 /var/www/html/example.com/testuser.php

http://example.com/testuser.php


Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog


Copyright © 2016 Kousik Chatterjee's Blog