티스토리 뷰
참고 : 이 문서는 개인적으로 참고 하기 위해 생성된 문서 이며, 설명 보다는 이미지가 많습니다.
제 지식이 짧은 관계로 자세한 내용은 다루지 않고 있습니다.
0. 사이트 현재 상황
- Classic ASP 로 개발되어 있는 사이트가 다수 있어 Windows Server 비용이 나가는 상태.
- Classic ASP 를 제대로 지원해주는 개발도구가 없으며, 소스의 버젼 관리 안되고 있음.
- 개발자 모두다 Classic ASP 보다 JAVA 를 선호.
- 업무가 단순하며, 짧게 사용하고 버려지는 페이지들이 많음. 그러나 배포를 위해 서비스를 내렸다가 올리는건 안됨.
위와 같은 이유로, 많은 웹 프레임워크가 존재 하지만...프레임워크를 사용 하지 않는 JSP Model 1 형식을 선택 하게 되었다.
php를 이용해 볼까도 격하게 생각해 본적이 있지만, PHP 를 사용 하기 위해 시스템 전역에 php, php-fpm을 설치 하는 것은 개인 적인 방침에 어긋나기도 하고, 사용자 별 다른 버젼의 php, php-fpm 사용 하기 위해서는 컴파일 하여 설치가 가능 하다고 하나 운영중인 서버에서 컴파일을 하는 것은 운영중인 서비스에 영향을 줄 것으로 판단 하여 제외 하였다.
0. 목표
- jsp 를 Classic ASP 와 같이 서버상에서 수정 및 로컬에서 개발 및 테스트가 동시에 가능 해야 함.
- jsp, java 의 버젼 관리가 되어야 한다.
- 배포를 위해 서비스를 내렸다 올리는 횟수의 최소화.
1. 프로젝트 생성
프로젝트 이름을 입력 후 "Finish" 버튼 클릭
로컬에서 Tomcat 서버 시작 시키면, 로컬 개발 환경 구성이 마무리 된다.
2. WAR 배포 하고 싶은 경우
그림에서 누락된 것이 "Application context" 를 / 로 수정 하도록 한다.
참고 : "Web Application : Archive" 를 선택 하는 경우 jsp 수정시 톰켓을 내렸다 올려야 적용 되는 경우가 생긴다.
최종 배포시에만 "Web Application : Archive" 를 선택 하도록 한다.
개발시 에는 "Web Application : Exploded" 에 두고 개발 하도록 한다.
4. 운영 서버의 nginx 의 개별 사이트 설정 파일.
/etc/nginx/site/etc/nginx/sites-enabled/jsp.freecatz.pe.kr
upstream jsp_freecatz_pe_kr {
ip_hash;
server 127.0.0.1:9001 weight=1 max_fails=3 fail_timeout=5s;
} # upstream end
server {
listen 80;
listen [::]:80;
server_name jsp.freecatz.pe.kr;
location / {
charset utf-8;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Forwarded-Port $server_port;
proxy_connect_timeout 150;
proxy_send_timeout 100;
proxy_read_timeout 100;
proxy_redirect off;
proxy_pass http://jsp_freecatz_pe_kr$request_uri;
} # location / end
} # server end
5. 운영 서버의 Tomcat 설정 파일.
/home/jsp/apache-tomcat-9.0.39/conf/server.xml
<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<Listener className="org.apache.catalina.security.SecurityListener" checkedOsUsers="root" />
<GlobalNamingResources>
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="9001"
protocol="HTTP/1.1"
connectionTimeout="5000"
disableUploadTimeout="true"
redirectPort="8443"
URIEncoding="UTF-8"
/>
<Engine name="Catalina" defaultHost="jsp.freecatz.pe.kr">
<Host name="jsp.freecatz.pe.kr"
appBase="webapps"
unpackWARs="true"
autoDeploy="true"
xmlValidation="false"
xmlNamespaceAware="false">
<Context className="org.apache.catalina.core.StandardContext"
wrapperClass="org.apache.catalina.core.StandardWrapper"
displayName="jsp.freecatz.pe.kr"
path=""
docBase="/home/jsp/web-root"
reloadable="true"
privileged="true"
antiResourceLocking="false"
antiJARLocking="false"
swallowOutput="false"
useNaming="true"
/>
<Context docBase="/home/jsp/files"
path="/files"
reloadable="true"
/>
</Host>
</Engine>
</Service>
</Server>
6. war 파일 업로드 및 압축 해제
로컬에 빌드된 war 파일을 운영 서버의 배포 디렉토리에 업로드 한다.
jsp@freecatz-pe-kr:~/web-root$ ls
'jsp.freecatz.pe.kr_war exploded.war'
jsp@freecatz-pe-kr:~/web-root$ unzip jsp.freecatz.pe.kr_war\ exploded.war
Archive: jsp.freecatz.pe.kr_war exploded.war
inflating: index.jsp
creating: WEB-INF/
inflating: WEB-INF/web.xml
jsp@freecatz-pe-kr:~/web-root$ ls
index.jsp 'jsp.freecatz.pe.kr_war exploded.war' WEB-INF
jsp@freecatz-pe-kr:~/web-root$ rm -rf jsp.freecatz.pe.kr_war\ exploded.war
jsp@freecatz-pe-kr:~/web-root$
jsp@freecatz-pe-kr:~/web-root$ ls
index.jsp WEB-INF
jsp@freecatz-pe-kr:~/web-root$
Tomcat 배포 디렉토리의 war 파일을 unzip 으로 압축 해제 후, war 파일은 삭제 한다.
이후, tomcat 을 실행 하고 nginx 를 시작 한다.
7. 운영 서버에서 jsp 코드 수정
8. SVN 연동
- Total
- Today
- Yesterday
- ssh
- TIP
- json parse
- Mobile
- gpkiapi
- Java
- dart
- Linux
- Android
- SSL
- JavaScript
- 맛집
- devel
- Fun
- 엘리스센터
- Flutter
- springboot
- samba
- MySQL
- place
- development
- Compile
- web
- Security
- food
- Review
- kotlin
- HTTP
- Spring
- devtools
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |