apache,tomcat 연동시 가상호스트 설정 (linux)

apache는 참 심플한데, tomcat은 까다롭다..

설정하는 것도, 튜닝하는 것도 여러가지 손 봐줘야할 것들이 참 많다.

 

java와 php를 함께 사용 하기 위해서는 apache + tomcat 연동해서 사용 하는 방법이 가장 많이 사용 되며, 일반적인 방법이다.

또 한가지 방법은 php-java-bridge를 설치해서 연동 해주는 방법이 존재한다.

(헌데 이 방법은 시도 해보다가 실패하여 시간이 없는 관계로 다음 포스팅에 대체 하도록 할 예정.)

 

하고자 했던 작업은 이렇다 단독톰캣 사용 하다가 php를 사용해야 했고,

몇몇개의 서브도메인이 존재하며, port base의 가상호스트 설정도 필요.

(php-java-bridge 설치를 하고자 했으나 실패. 그래서 apache 연동 설정으로 변경.)

 

 

apache 설치과정 생략.

tomcat path : /usr/local/tomcat

apache path : /usr/local/apache2

php path : /usr/local/php

 

– tomcat 단독 구성 되어 있었기 때문에 80 port 사용 => 8080 port 변경

vi /usr/local/tomcat/conf/server.xml

#=== 중략 ====

<Connector port=”8080” protocol=”HTTP/1.1″
connectionTimeout=”20000″
redirectPort=”8443″ />
<!– A “Connector” using the shared thread pool–>
<!–
<Connector executor=”tomcatThreadPool”
port=”8080″ protocol=”HTTP/1.1″
connectionTimeout=”20000″
redirectPort=”8443″ />

 

* 반대로 위 커넥터 부분의 port를 Default 상태인 8080 => 80으로 변경하여 단독 톰켓 구성이 가능하다.

 

apache workers.properties 설정

– 80 외에 8009, 9099 port 와 같이 두개의 포트 추가 사용을 위해 세개의 worker.list 추가

vi /usr/local/apache2/conf/workers.properties

 

workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/java/
ps=/
worker.list=rubi1,rubi2,rubi3

worker.rubi1.port=8009
worker.rubi1.host=localhost
worker.rubi1.type=ajp13
worker.rubi1.lbfactor=1

worker.rubi2.port=8010
worker.rubi2.host=localhost
worker.rubi2.type=ajp13
worker.rubi2.lbfactor=1

worker.rubi3.port=8011
worker.rubi3.host=localhost
worker.rubi3.type=ajp13
worker.rubi3.lbfactor=1

 

apache 가상호스트 설정 (아파치 기본 설정 생략)

– vi /usr/local/apache2/conf/extra/httpd-vhosts.conf

 

NameVirtualHost *:80

NameVirtualHost *:8001
NameVirtualHost *:9099

 

<VirtualHost *:80>
ServerAdmin admin@rubi.kr
DocumentRoot “/home/rubi/public_html
ServerName rubi.kr
ServerAlias www.rubi.kr
ErrorLog “logs/www.rubi.kr-error_log”
CustomLog “logs/www.rubi.kr-access_log” common
JkMount /*.jsp rubi1
JkMount /*.do rubi1

JkMount /servlet/* rubi1
</VirtualHost>

<VirtualHost *:8001>
ServerAdmin admin@rubi.kr

DocumentRoot “/home/rubi/www2
ServerName rubi.kr
ServerAlias www.rubi.kr
ErrorLog “logs/8001-error_log”
CustomLog “logs/8001-access_log” common
JkMount /*.jsp rubi2
JkMount /*.do rubi2
JkMount /servlet/* rubi2
</VirtualHost>

<VirtualHost *:9099>
ServerAdmin admin@rubi.kr
DocumentRoot “/home/rubi/www3
ServerName rubi.kr
ServerAlias www.rubi.kr
ErrorLog “logs/9099-error_log”
CustomLog “logs/9099-access_log” common
JkMount /*.jsp rubi3
JkMount /*.do rubi3
JkMount /servlet/* rubi3
</VirtualHost>

 

 

– tomcat 가상호스트 설정

가상호스트 추가 진행, 기본 localhost path 변경

 

vi /usr/local/tomcat/conf/server.xml

 

<Host name=”rubi.kr” appBase=”/home/rubi/public_html”
unpackWARs=”true” autoDeploy=”true”
xmlValidation=”false” xmlNamespaceAware=”false”>
<Context path=”” docBase=”” reloadable=”true”/>
<Alias>www.rubi.kr</Alias>

 

<!– 80port로 2차 호스트인 test.rubi.kr 가상호스트 추가 –>

<Host name=”test.rubi.kr” appBase=”/home/test/www”

unpackWARs=”true” autoDeploy=”true”
xmlValidation=”false” xmlNamespaceAware=”false”>
<Context path=”” docBase=”” reloadable=”true”/>
</Host>

 

</Engine>
</Service>

 

<!– port 변경에 따른

<Service name=”Catalina2″>
<Connector port=”8002” protocol=”HTTP/1.1″
connectionTimeout=”20000″
redirectPort=”8443″ />
<Connector port=”8010″ protocol=”AJP/1.3″ redirectPort=”8443″ />
<Engine name=”Catalina2” defaultHost=”localhost”>
<Realm className=”org.apache.catalina.realm.UserDatabaseRealm”
resourceName=”UserDatabase”/>
<Host name=”rubi.kr” appBase=“/home/rubi/www2”
unpackWARs=”true” autoDeploy=”true”
xmlValidation=”false” xmlNamespaceAware=”false”>
<Context path=”” docBase=”” reloadable=”true”/>
</Host>
</Engine>
</Service>
<Service name=”Catalina3“>
<Connector port=”9100” protocol=”HTTP/1.1″
connectionTimeout=”20000″
redirectPort=”8443″ />
<Connector port=”8011″ protocol=”AJP/1.3″ redirectPort=”8443″ />
<Engine name=”Catalina3” defaultHost=”localhost”>
<Realm className=”org.apache.catalina.realm.UserDatabaseRealm”
resourceName=”UserDatabase”/>
<Host name=”rubi.kr” appBase=“/home/rubi/www3”
unpackWARs=”true” autoDeploy=”true”
xmlValidation=”false” xmlNamespaceAware=”false”>
<Context path=”” docBase=”” reloadable=”true”/>
</Host>
</Engine>
</Service>

 

 

tomcat 가상 호스트 설정시 아래 부분을 추가 해줌으로써 appbase= 지정경로 밑에 ROOT를 홈디렉토리로 인식하는 부분을 해결 할 수 있다.

<Context path=”” docBase=”” reloadable=”true”/>

 

여기까지가 설정 모두 종료.

 

http://www.rubi.kr/ 연결시 /home/rubi/public_html/ 내용 출력

http://www.rubi.kr:8001 연결시 /home/rubi/www2 출력

http://www.rubi.kr:9099 연결시 /home/rubi/www3 출력

http://test.rubi.kr 연결시 /home/test/www 출력

 

Comments

comments

5 댓글

  1. Doctor Who is now considered a British Institute and has come a long way since it first aired on November 23rd 1963. The very first show saw the Doctor travel 100,00 years into the past to help some dim cavemen discover light. After 26 seasons and seven Doctors later the series came off our screens in 1989 much to the disappointment of the huge devoted fanbase. In 1996 an attempt was made to revive Doctor Who but it wasnt until June 2005 when it came back with a vengeance with Christopher Eccleston as the ninth Doctor that put the series back on the map as it were. It then went on for 5 years with David Tenant portraying the Doctor until 2010 when Matt Smith took over the role. Today it is still a great family show and has attracted many new fans.

    If youre a new or old fan of the show there are Tours and museums you can go and see some of the locations and memorabilia of this classic show. The Doctor Who Tour of London will take you on over 15 locations from the show, some from the new series and some from old sites like the location of The Invasion and Resurrection of the Darleks. The tour also takes you to the TV museum in London where you will get to see some of the cosumes worn in the show and props used. Also you can buy gifts and memorabilia from the shop.

    You will learn all about how the shows were made so the tour is also educational. If you want to take pictures of the locations thats not a problem. Remember the front door of 10 Downing Street in Aliens of London? Well you can get up and close to this and get your picture taken in front of the door. Rose Tyler fans will love the tour as you get to drop by her home in the show.

    Why not go that extra mile and actually meet a Doctor Who star. Well this is possible with private or group tours. You will get the general tour but included will be a pre-arranged meeting or lunch with a celebrity from the show. This will obviously depend on availability of the celebrity and the cost will reflect the popularity of that celebrity.

    There are tours in London and also Wales. The Wales tours take you to Cardiff where you will see lots of location which were featured in shows since 2005. You can leave from London or at Leigh Delamere services station on the M4. There is a Doctor Who exhibition in Cardiff which you get to see. At the end of the Doctor Who tour you get a souvenir group picture sent you by email which is a nice touch.

    For seriously devoted Doctor Who fans there is a 3 day tour which takes you to all the locations in both London and Cardiff. You will see locations from the past 45 years as well as recent sites from the lasted Doctor Who series. Day one is based in London where you get to see 15 sites. Day two takes you to Cardiff where you get to mean the real life owner of the to see we have an Gothic property used as the location of the school in Human Nature. The final day is partly spent in Cardiff with a walking tour at Cardiff Bay, then you head back to London but a stop at Stonehenge to see the site of the Pandoica. Then its dinner at The Cloven Hoof pub in Devils End b efore you taken back to central London.

     

  2. Writing a medical thesis or dissertation is a task done by almost all postgraduate and master’s medical students. Dissertation is derived from the Latin word disserto which means discuss. It is essential to write successful medical papers such as medicine essays and medical thesis papers. There are several reasons as to why students write medicine essays. One of the reasons is to promote enhancement of critical judgment, research skills as well as analytical skills. Moreover, medicine essay writing produce students with the ability to 4evaluate and analyze data critically.

    The initial step for writing medicine essays is to choose a topic. A writer should have at least three topics to choose from. The topic has to be interesting, feasible and relevant. It is essential to write quality medicine essay. Hence, students need to have analytical skills and perfect writing skills. The writing skills will enable them write outstanding essay papers that can be highly regarded by instructors and professors. Teachers often require a lot and expect a lot from their students in terms of medicine essay writing. for this reason, students find essay writing to be an extremely difficult task and hence resort to buying custom medicine essays.

    A custom medicine essay has to be written by professional writers who are qualified in the field of nursing. Moreover, the custom medicine essay has to be original and plagiarism free. This means that it has to be written from scratch by experts with many years experience. The many years experience should enable a writer to write any form of medical paper including medical thesis, medicine essay and even medicine research paper. Moreover, experience will enable a writer to write a medicine essay that can guarantee academic success.

    Students get custom medicine essays from custom writing company. It is essential to choose the best company so that one can get the best custom medicine essay. The best and the most reliable medicine essay writing company should have some unique characteristics such as affordability and the ability to provide original and superior quality medicine essays. The other quality is that the company has to hire expert writers who can write quality medicine essays and other types of medical papers. The essays should not only be quality but also plagiarism free and free of grammatical and spelling mistakes.

    A custom medicine essay has a similar structure to any other academic essay assignment. It has an introduction that introduces the topic and tells the reader what the essay is all about. The second section is the body that has many paragraphs supporting the main topic. Finally there is the conclusion that briefly summarizes what has been discussed in the body section of the essay. Students should choose reliable writing companies so that they can get quality custom papers on several fields such as technology, sociology and law in addition to medicine field.

    Our custom writing company is the best company that all clients should rely on when in need of any given type of medicine paper. We provide quality papers that not only plagiarism free but also original. Moreover, our custom papers are affordable and able to guarantee academic excellence at all times. All our medical papers are reliable and sure of satisfying clients at all times.

     

  3. A Biological Masterpiece, But Subject to Many Ills
    The human foot is a biological masterpiece. Its strong, flexible, and functional design enables it to do its job well and without complaint—if you take care of it and don’t take it for granted.
    healthThe foot can be compared to a finely tuned race car, or a space shuttle, vehicles whose function dictates their design and structure. And like them, the human foot is complex, containing within its relatively small size 26 bones (the two feet contain a quarter of all the bones in the body), 33 joints, and a network of more than 100 tendons, muscles, and ligaments, to say nothing of blood vessels and nerves.
    https://www.cialissansordonnancefr24.com/cialis-soft/

  4. Earn on the Internet from $ 5000 per day, do not strain, the details are here: http://pagebin.com/R7euSl2q

    sbi bank account transfer application hindi, how do you make money online yahoo answers, make money online with little investment, bnz credit card transfer rate, how to win easy money on pokerstars, ways to make money while at home, online casino deposit by phone, moneygram transfer 2017 database software
    , online casino no deposit bonus united states, paypal money request have protection, citibank credit card balance transfer offer, how to make money as a writer uk, how to make your voice sound professional on garageband, how can you make money with google adsense, make money selling digital products, how can i make some extra cash at home, online casino free play no deposit malaysia, online live casino holdem, online casino real money no deposit malaysia
    , free online casino surveillance training, how to earn money online best ways, online casino win free money, how to make money transfer website, make money online game, $1 deposit online casino nz, how to make money online from home legit, earn money online surveys canada

답글 남기기

이메일은 공개되지 않습니다. 필수 입력창은 * 로 표시되어 있습니다.