Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

apache

yum install httpd
chkconfig httpd on
service iptables stop
service httpd start

vi /etc/httpd/conf/httpd.conf
#uncomment
ServerName hasaranga.com:80
#in end of the page
<VirtualHost *:80>
    ServerName hasaranga.com
    DocumentRoot "/var/www/html/"
  #  ErrorLog "logs/apps-ptrl-error.log"
  #  CustomLog "logs/apps-ptrl-access.log" common

    # Puts here, before Directory directive :)
    Alias /a1 "/var/www/html/a1"

    <Directory "/var/www/html/a1">
        allow from all
        order allow,deny
        AllowOverride All
    </Directory>
</VirtualHost>

///////////////
##############<VirtualHost *:80>
############ ServerName prasad.com
############    DocumentRoot "/var/www/html/b1"
############</VirtualHost>
############if you want more ##########
///////////////////


#creating sample directory for web site a1
mkdir /var/www/html/a1
echo "this is a1" > /var/www/html/a1/index.html

###########more than 1 domain name ########
uncomment NameVirtualHost *:80
comment #ServerName hasaranga.com:80 upper one, not vrtual host one
then add next virtual host,
,
if you need just name, withou alias,

<VirtualHost *:80>
    ServerName hasaranga.com
    DocumentRoot "/var/www/html/h1"
  #  ErrorLog "logs/apps-ptrl-error.log"
  #  CustomLog "logs/apps-ptrl-access.log" common

    # Puts here, before Directory directive :)
   #Alias /h1 "/var/www/html/h1"

    <Directory "/var/www/html/h1">
        allow from all
        order allow,deny
        AllowOverride All
    </Directory>
</VirtualHost>


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@222
#creating passwor file
mkdir /etc/htpasswd/
htpasswd -c /etc/htpasswd/.htpasswd  hasa

#change Derectory tag of above conf like this if you want password
<Directory "/var/www/html/a1">
AuthType Basic
  AuthName "Authentication Required"
  AuthUserFile "/etc/htpasswd/.htpasswd"
  Require valid-user

 #  allow from all
      #  order allow,deny
      #  AllowOverride All
    </Directory>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

C:\Windows\System32\drivers\etc\hosts
192.168.137.11 www.hasaranga.com


----
 www.hasaranga.com/a1



https://httpd.apache.org/docs/2.4/vhosts/examples.html



---------------------------------
JK MOUNT / UNMOUNT 

<VirtualHost *:80>

    ServerAdmin admin@localhost.com
    DocumentRoot "D:\Dev-Ops\apache\Apache2\htdocs"
    ServerName localhost.com

    JkMount /SchoolApp/* loadbalancer
    JkMount /SchoolApp loadbalancer
    JkUnMount /SchoolApp/*jpg loadbalancer
    JkUnMount /SchoolApp/*.html loadbalancer

</VirtualHost>
 
JkMount /SchoolApp/* redirects all the requests from Apache to the jboss web application SchoolApp (here : http://localhost.com:8080/SchoolApp/); since I have used
JkUnMount /SchoolApp/*jpg loadbalancer it will not redirect any requests for jpg files to jboss, instead it will look for SchoolApp/ folder under "D:\Dev-Ops\apache\Apache2\htdocs" and serve images from there, I have a proper directory structure under there that mimics the directory structure for the jpg file I have requested from the Jboss web application.
e.g. If I request for http://localhost.com/SchoolApp/, mod-jk redirects the request to http://localhost.com:8080/SchoolApp/ however; if I request for http://localhost.com/SchoolApp/welcome.jpg, this request will not be redirected to the http://localhost.com:8080/SchoolApp/welcome.jpg even if there is such a file under the jboss application, instead it will look for welcome.jpg under the htdocs/SchoolApp/ folder in apache and if welcome.jpg exists there, it will serve the file from there.



#############################################################

Jboss example-1 for jk mount


running 3 jboss
https://drive.google.com/file/d/0B_HG6_iDrJyDYzBlLWRqekI4eEE/view?usp=sharing

httpd.conf
------------------------------------------
<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from none
    Allow from all 
</Directory>

# The following directives modify normal HTTP response behavior to
# handle known problems with browser implementations.
#
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0

#
# The following directive disables redirects on non-GET requests for
# a directory that does not include the trailing slash.  This fixes a
# problem with Microsoft WebFolders which does not appropriately handle
# redirects for folders with DAV methods.
# Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.
#
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
BrowserMatch "^gnome-vfs/1.0" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully



LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel debug

 <IfModule mod_mem_cache.c>
  CacheEnable mem /
  MCacheMaxObjectCount     10000
  MCacheMaxObjectSize      262144
  MCacheRemovalAlgorithm   LRU
  MCacheSize               262144
  MCacheMinObjectSize      1
  MCacheMaxStreamingBuffer 65536
</IfModule>

###########################################################################################
AddOutputFilterByType DEFLATE  text/html text/plain text/javascript application/javascript text/css
SetOutputFilter DEFLATE
AddOutputFilter INCLUDES;DEFLATE htm html js css do
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI  \.(?:gif|jpeg|jpg|png|avi|swf)$ no-gzip dont-vary
###########################################################################################



<VirtualHost 192.168.137.12:80>
ServerName hasa.blog
DocumentRoot /mysystem/staticdata

Alias /webapp/css /mysystem/staticdata/css
Alias /webapp/img /mysystem/staticdata/img

#Alias /webapp "give centerlized location war path if nodes are load balanced"
#ex:
Alias /webapp "/mysystem/EAR/webapp.war"

# cd /mysystem/jboss/jboss_2/server/default/deploy
# ln -s /mysystem/EAR/webapp.war 
#Do above for other 2 jbosses


JkLogFile logs/mod_jk.log
JkLogLevel    emerg
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions     +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat     "%w %V %T"
JkMount /webapp* balancer
JkMount /status stat
JkMount /*.jsp balancer
JkMount /servlet/* balancer
JkMount /*.do balancer

JkUnMount /*/*.gif       balancer
JkUnMount /*/*.html      balancer
JkUnMount /*/*.htm       balancer
JkUnMount /*/*.php       balancer
JkUnMount /*/*.jpg       balancer
JkUnMount /*/*.png       balancer
JkUnMount /*/*.css       balancer
JkUnMount /*/*.cs        balancer
JkUnMount /*/*.config    balancer
JkUnMount /*/*.js        balancer
JkUnMount /*/*.txt       balancer
JkUnMount /*/*.pm        balancer
JkUnMount /*/*.pl        balancer

###   CustomLog logs/webapp.hasa.blog.bytes bytes
###   CustomLog logs/webapp.hasa.blog.log combined
###   ErrorLog logs/webapp.hasa.blog.error.log

</VirtualHost>

<Location /status>
#  SetHandler jkmanager
  Order Deny,Allow
  Deny from all
  Allow from 192.168.1.0/23
</Location>
--------------------------
workers.properties
---------------------------

worker.list=balancer,stat

worker.tomcat1.type=ajp13
worker.tomcat1.host=localhost
worker.tomcat1.port=8009
worker.tomcat1.lbfactor=10
#worker.tomcat1.activation=A

worker.tomcat2.type=ajp13
worker.tomcat2.host=localhost
worker.tomcat2.port=8109
worker.tomcat2.lbfactor=10
#worker.tomcat2.activation=A

worker.tomcat3.type=ajp13
worker.tomcat3.host=localhost
worker.tomcat3.port=8209
worker.tomcat3.lbfactor=10
#worker.tomcat3.activation=A

#worker.tomcat3.type=ajp13

#worker.tomcat3.port=8209
#worker.tomcat3.lbfactor=10#worker.anotherapptomcat3.host=128.121.146.120


worker.balancer.type=lb
worker.balancer.balance_workers=tomcat1,tomcat2,tomcat3

worker.balancer.sticky_session=1
#worker.balancer.sticky_session=0
#with no sticky_session_force

worker.balancer.method=B
worker.balancer.socket_timeout=60
worker.balancer.recycle_timeout=50
#worker.loadbalancer1.sticky_session_force=1    ##use this if not load balance
worker.balancer.lock=O

worker.stat.type=status
-----------------------------
###############################
cd /mysystem/staticdata/
ll>
 css
 img

Note:these css and img files are Eclipese\works\webapp\WebContent inside folders .
just copied them in to /mysystem/staticdata/



###############################################################3
worker.tomcat3.lbfactor=10
Only used for a member worker of a load balancer.
The integer number lbfactor (load-balancing factor) is how much we expect this worker to work, or the worker's work quota. Load balancing factor is compared with other workers that makes the load balancer. For example if one worker has lb_factor 5 times higher then other worker, then it will receive five times more requests.

worker.tomcat3.activation=A
Using this directive, a balanced worker of a load balancer can be configured as disabled or stopped. A disabled worker only gets requests, which belong to sessions for that worker. A stopped worker does not get any requests. Users of a stopped worker will lose their sessions, unless session replication via clustering is used.
Use d or D to disable and s or S to stop. If this directive is not present the deprecated directives "disabled" or "stopped" are used.
This flag can be changed at runtime using status worker.
This feature has been added in jk 1.2.19.

worker.tomcat3.domain=hasa
main directive can be used only when the worker is a member of the load balancer. Workers that share the same domain name are treated as single worker. If sticky_session is used, then the domain name is used as session route.
This directive is used for large system with more then 6 Tomcats, to be able to cluster the Tomcats in two groups and thus lowering the session replication transfer between them.
This feature has been added in jk 1.2.8.

worker.loadbalancer1.sticky_session=1
Specifies whether requests with SESSION ID's should be routed back to the same Tomcat worker. If sticky_session is set to true sessions are sticky, otherwise sticky_session is set to false. Set sticky_session to false when Tomcat is using a Session Manager which can persist session data across multiple instances of Tomcat.
The sticky_session setting can be overwritten using the Apache httpd environment variable JK_STICKY_IGNORE and the worker map extension for sticky_ignore. This has been added in version 1.2.33.

worker.loadbalancer1.balance_workers=tomcat1,tomcat2,tomcat3
A comma separated list of workers that the load balancer need to manage.
This directive can be used multiple times for the same load balancer.
This directive replaces old balanced_workers directive and can be used only with mod_jk versions 1.2.7 and up.
As long as these workers should only be used via the load balancer worker, there is no need to also put them into the worker.list property.

worker.loadbalancer1.type=lb
Type of the worker (can be one of ajp13, ajp14, jni, lb or status). The type of the worker defines the directives that can be applied to the worker.
Type ajp13 is the preferred worker type that JK uses for communication between web server and Tomcat. This type of worker uses sockets as communication channel. For detailed description of the AJP13 protocol stack browse to AJPv13 protocol specification
Type ajp14 is experimental and not recommended.
JNI workers have been deprecated. They will likely not work. Do not use them.

worker.loadbalancer1.method=R  / method=B
Specifies what method load balancer is using for electing the best worker. Please note, that session stickiness and perfect load balancing are conflicting targets, especially when the number of sessions is small, or the usage of sessions is extremely varying For huge numbers of sessions this usually is not a problem.
Some methods note, that they aggregate in a sliding time window. They add up accesses, and on each run of the global maintain method, the load counters get divided by 2. Usually this happens once a minute, depending on the setting of worker.maintain. The value of the load counters can be inspected using the status worker.
If method is set to R[equest] the balancer will use the number of requests to find the best worker. Accesses will be distributed according to the lbfactor in a sliding time window. This is the default value and should be working well for most applications.
If method is set to S[ession] the balancer will use the number of sessions to find the best worker. Accesses will be distributed according to the lbfactor in a sliding time window. This method should be used, if sessions are your limiting resource, e.g. when you only have limited memory and your sessions need a lot of memory. Because the balancer does not keep any state, it actually does not know the number of sessions. Instead it counts each request without a session cookie or URL encoding as a new session. This method will neither know, when a session is being invalidated, nor will it correct its load numbers according to session timeouts or worker failover. If you know request URLs, that will be called without a session ID but should not be counted as new sessions, you should add them to the stateless mapping rule extension or set the Apache HTTPD environment variable JK_STATELESS for them.
If method is set to N[ext] the balancer will again use the number of sessions to find the best worker. All remarks concerning the Sessionmethod apply as well. The difference to the Session method is how the session count is handled in the sliding time window. The Next method does not divide by 2, instead it subtracts the current minimum number. This should effectively result in a round-robin session balancing, thus the name Next. Under high load, the two session balancing methods will result in a similar distribution, but Next will be better if you need to distribute small numbers of sessions.
If set to T[raffic] the balancer will use the network traffic between JK and Tomcat to find the best worker. Accesses will be distributed according to the lbfactor in a sliding time window. This method should be used, if network to and from the backends is your limiting resource.
If set to B[usyness] the balancer will pick the worker with the lowest current load, based on how many requests the worker is currently serving. This number is divided by the workers lbfactor, and the lowest value (least busy) worker is picked. This method is especially interesting, if your request take a long time to process, like for a download application. The method is not recommended for general use, because under high load on some hardware architectures the busy counter can become wrong.
This feature has been added in version 1.2.9. The Session method has been added in version 1.2.20, the Next method in version 1.2.33.

worker.loadbalancer1.socket_timeout=60
Socket timeout in seconds used for the communication channel between JK and remote host. If the remote host does not respond inside the timeout specified, JK will generate an error, and retry again. If set to zero (default) JK will wait for an infinite amount of time on all socket operations.

worker.loadbalancer1.recycle_timeout=50
This directive has been deprecated since 1.2.16.
The number of seconds that told webserver to cut an ajp13 connection after some time of inactivity. When choosing an endpoint for a request and the assigned socket is open, it will be closed if it was not used for the configured time. It's a good way to ensure that there won't too old threads living on Tomcat side, with the extra cost you need to reopen the socket next time a request be forwarded. This property is very similar to cache_timeout but works also in non-cache mode. If set to value zero (default) no recycle will took place.

#worker.loadbalancer1.sticky_session_force=1
Specifies whether requests with SESSION ID's for workers that are in error state should be rejected. If sticky_session_force is set to true and the worker that matches that SESSION ID is in error state, client will receive 500 (Server Error). If set to false failover on another worker will be issued with losing client session. This directive is used only when you set sticky_session=true.
This feature has been added in jk 1.2.9.

worker.loadbalancer1.lock=O
Specifies what lock method the load balancer will use for synchronising shared memory runtime data. If lock is set to O[ptimistic] balancer will not use shared memory lock to find the best worker. If set to P[essimistic] balancer will use shared memory lock. The balancer will work more accurately in case of Pessimistic locking, but can slow down the average response time.
This feature has been added in jk 1.2.13.


Jboss example-2 for jk mount
No balance - redirect particular war

(Running 2 jboss, 8080=webapp1 war and 8180=webapp2 war)

change windows pc host file, 192.168.0.95 one.hasa.blog two.hasa.blog
change centos(server) host file 192.168.0.95 one.hasa.blog two.hasa.blog

vim httpd.conf


# The following directives modify normal HTTP response behavior to
# handle known problems with browser implementations.
#
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0

#
# The following directive disables redirects on non-GET requests for
# a directory that does not include the trailing slash.  This fixes a
# problem with Microsoft WebFolders which does not appropriately handle
# redirects for folders with DAV methods.
# Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.
#
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
BrowserMatch "^gnome-vfs/1.0" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully



LoadModule    jk_module /mysystem/apache2/modules/mod_jk.so

JkWorkersFile /mysystem/apache2/conf/workers.properties

JkLogFile     logs/mod_jk.log
JkLogLevel    emerg



#JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
#JkOptions     +ForwardKeySize +ForwardURICompat -ForwardDirectories
#JkRequestLogFormat     "%w %V %T"
#JkMount /webapp/* balancer
#JkMount /status stat

<IfModule mod_mem_cache.c>
  CacheEnable mem /
  MCacheMaxObjectCount     10000
  MCacheMaxObjectSize      262144
  MCacheRemovalAlgorithm   LRU
  MCacheSize               262144
  MCacheMinObjectSize      1
  MCacheMaxStreamingBuffer 65536
</IfModule>

###########################################################################################
AddOutputFilterByType DEFLATE  text/html text/plain text/javascript application/javascript text/css
SetOutputFilter DEFLATE
AddOutputFilter INCLUDES;DEFLATE htm html js css do
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI  \.(?:gif|jpeg|jpg|png|avi|swf)$ no-gzip dont-vary
###########################################################################################


<VirtualHost 192.168.0.95:80>
        ServerName one.hasa.blog
        DocumentRoot /mysystem/staticdata

        JkMount /status* stat
        JkMount /*.jsp balancer
        JkMount /webapp1* balancer
         JkMount /servlet/* balancer
         JkMount /*.do balancer

        JkUnMount /*/*.gif*      balancer
        JkUnMount /*/*.html      balancer
        JkUnMount /*/*.htm       balancer
        JkUnMount /*/*.php       balancer
        JkUnMount /*/*.jpg       balancer
        JkUnMount /*/*.png       balancer
        JkUnMount /*/*.css       balancer
        JkUnMount /*/*.cs        balancer
        JkUnMount /*/*.config    balancer
        JkUnMount /*/*.js        balancer
        JkUnMount /*/*.txt       balancer
        JkUnMount /*/*.pm        balancer
        JkUnMount /*/*.pl        balancer




<IfModule mod_mem_cache.c>
  CacheEnable mem /
  MCacheMaxObjectCount     10000
  MCacheMaxObjectSize      262144
  MCacheRemovalAlgorithm   LRU
  MCacheSize               5120
  MCacheMinObjectSize      1
  MCacheMaxStreamingBuffer 65536
</IfModule>

AddOutputFilterByType DEFLATE  text/html text/plain text/javascript application/javascript
SetOutputFilter DEFLATE
AddOutputFilter INCLUDES;DEFLATE htm html js css do swf
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI  \.(?:gif|jpeg|jpg|png|avi|swf)$ no-gzip dont-vary

        Alias /webapp1/img /mysystem/staticdata/img
        Alias /webapp1/css /mysystem/staticdata/css
        Alias /webapp1 "/mysystem/jboss/jboss_1/server/default/deploy/webapp1.war"
CustomLog "logs/webapp1" combined  

</VirtualHost>



<VirtualHost 192.168.0.95:80>
        ServerName two.hasa.blog
        DocumentRoot /mysystem/staticdata2

        JkMount /status* stat
        JkMount /*.jsp balancer2
        JkMount /webapp2* balancer2
         JkMount /servlet/* balancer2
         JkMount /*.do balancer2

        JkUnMount /*/*.gif*      balancer2
        JkUnMount /*/*.html      balancer2
        JkUnMount /*/*.htm       balancer2
        JkUnMount /*/*.php       balancer2
        JkUnMount /*/*.jpg       balancer2
        JkUnMount /*/*.png       balancer2
        JkUnMount /*/*.css       balancer2
        JkUnMount /*/*.cs        balancer2
        JkUnMount /*/*.config    balancer2
        JkUnMount /*/*.js        balancer2
        JkUnMount /*/*.txt       balancer2
        JkUnMount /*/*.pm        balancer2
        JkUnMount /*/*.pl        balancer2


<IfModule mod_mem_cache.c>
  CacheEnable mem /
  MCacheMaxObjectCount     10000
  MCacheMaxObjectSize      262144
  MCacheRemovalAlgorithm   LRU
  MCacheSize               5120
  MCacheMinObjectSize      1
  MCacheMaxStreamingBuffer 65536
</IfModule>

AddOutputFilterByType DEFLATE  text/html text/plain text/javascript application/javascript
SetOutputFilter DEFLATE
AddOutputFilter INCLUDES;DEFLATE htm html js css do swf
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI  \.(?:gif|jpeg|jpg|png|avi|swf)$ no-gzip dont-vary


        Alias /webapp2/img /mysystem/staticdata2/img
        Alias /webapp2/css /mysystem/staticdata2/css
        Alias /webapp2 "/mysystem/jboss/jboss_2/server/default/deploy/webapp2.war"
 CustomLog "logs/webapp2" combined    
</VirtualHost>



<Location /status>
#  SetHandler jkmanager
  Order Deny,Allow
  Deny from all
  Allow from 192.168.1.0/23
</Location>


@@@@@@@@@@@@@@
workers.properties

worker.list=balancer, balancer2, stat

worker.tomcat1.type=ajp13
worker.tomcat1.host=192.168.0.95
worker.tomcat1.port=8009
worker.tomcat1.lbfactor=10

worker.tomcat2.type=ajp13
worker.tomcat2.host=192.168.0.95
worker.tomcat2.port=8109
worker.tomcat2.lbfactor=10

worker.tomcat3.type=ajp13
worker.tomcat3.host=192.168.0.95
worker.tomcat3.port=8209
worker.tomcat3.lbfactor=10



worker.balancer.type=lb
worker.balancer.balance_workers=tomcat1
worker.balancer.sticky_session=1
worker.balancer.method=B
worker.balancer.socket_timeout=60
worker.balancer.recycle_timeout=50
worker.balancer.sticky_session_force=1
worker.balancer.lock=O

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


restart apache and,
now urls=
http://one.hasa.blog/webapp1/
http://two.hasa.blog/webapp2/

No comments:

Post a Comment