레이블이 web&was인 게시물을 표시합니다. 모든 게시물 표시
레이블이 web&was인 게시물을 표시합니다. 모든 게시물 표시

2022년 7월 26일 화요일

Wildfly 기본정보


Wildfly 이해

  • Redhat이 2006년 Jboss inc 인수
  • Java EE(Enterprise Edition)을 모두 지원
  • 상용 솔루션으로는 JBoessEAP가 있고, Wildfly (구 JBoss AS)는 커뮤니티 성 솔루션
  • java EE 의 전체 Stack은 다음 Diagram으로 대체
대표사진 삭제

사진 설명을 입력하세요.

1.Wildfly와 Tomcat의 stack 비교

항 목
Wildfly
Tomcat
제공기능
Application Server (Tomcat 내장)
Servlet Container (web server)
메모리 사용량
Tomcat대비 많음(2~300M)
상대적으로 적음 (6~70M)
DB Connection
내장
없음(별도 라이브러리 사용필요)
장/단점
JAVA EE를 포함하고 있기 때문에 다양한 기능 제공
메모리 점유율이 높음
J2EE전체 기능이 필요없는 경우 사용
상대적으로 가볍게 작동함
Link


구동모드 설정


구동모드
상세설명
standalone
단일 인스턴스로 실행
인스턴스단위로 프로파일 및 설정파일이 개별적으로 작동
domain
도메인 컨트롤러 포함
다수 인스턴스가 그룹으로 구성, 인스턴스별 그룹지정이 가능하고, 그릅단위로 설정


Wildfly 프로파일 설명

프로파일명
설정파일
제공기능
default
standalone
infinispan, ee, ejb3
ha
standalone-ha
jgroup, modcluster, infinispan, ee, ejb3
full
standalone-full
jacorb, messagging, webservice, infinispan, ee, ejb3
full-ha
standalone-full-ha
jacorb, messagging, webservice, jgroup, modcluster, infinispan, ee, ejb3


디렉토리 구조

디렉토리
설명
appclient
클라이언트용 홈디렉토리
bin
스크립트 파일
docs
xml / 설정파일
docs/examples/configs
예시 구성파일
domain
domain 홈디렉토리
modules
추가 모듈 디렉토리
standalone
standalone 모드 홈 디렉토리
standalone/configuration
standalone 모드 설정파일
standalone/data
standalone 모드 생성파일
standalone/deployments
app배포
standalone/lib/
JAVA EE / SE 라이브러리
standalone/log
로그파일 저장소
standalone/tmp
임시파일 저장소
welcome-content
첫 페이지 경로


Wildfly 설치

java (1.8이상 설치 필요)

$ yum install java-1.8.0 -y
...
$ which java
/usr/bin/java

$ /usr/bin/java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)

바이너리 다운로드 후 압축해제

$> wget https://download.jboss.org/wildfly/24.0.0.Final/wildfly-24.0.0.Final.tar.gz
$> tar -zxvf wildfly-24.0.0.Final.tar.gz -C /usr/local/
$> ln -s /usr/local/wildfly-24.0.0.Final/ /usr/local/wildfly

외부 접속 허용하기

 vi /usr/local/wildfly-24.0.0.Final/standalone/configuration/standalone.xml
...
        <interface name="public">
            <inet-address value="${jboss.bind.address:0.0.0.0}"></inet-address>
        </interface>
...

management user 생성

 
./add-user.sh

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a): a

Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : {{ 계정명 }}
Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
 - The password should be different from the username
 - The password should not be one of the following restricted values {root, admin, administrator}
 - The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
Password : {{ 계정 패스워드 }}
Re-enter Password : {{ 계정 패스워드 }}
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[  ]:
About to add user 'csadmin' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'csadmin' to file '/usr/local/wildfly-24.0.0.Final/standalone/configuration/mgmt-users.properties'
Added user 'csadmin' to file '/usr/local/wildfly-24.0.0.Final/domain/configuration/mgmt-users.properties'
Added user 'csadmin' with groups  to file '/usr/local/wildfly-24.0.0.Final/standalone/configuration/mgmt-groups.properties'
Added user 'csadmin' with groups  to file '/usr/local/wildfly-24.0.0.Final/domain/configuration/mgmt-groups.properties'
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server Jakarta Enterprise Beans calls.
yes/no? yes
To represent the user add the following to the server-identities definition <secret value="Y3MxMjMhQCM=" ></secret>

실행하기

 ./bin/standardalone.sh &

접속하기

  • 브라우져 로그인 : http://{{ 서버IP }}:8080/
  • 관리자 콘솔 로그인 : http:~/~/~{~{ 서버IP }}:9990/console/index.html>>http://서버ip:9990/console/index.html]] (로그인 계정은 4. management user 생성 참고)



참조

http://igoni.kr/books/linux/page/wildfly

2022년 7월 24일 일요일

업로드폴더 웹실행 차단.

 

웹에서 사용중인 폴더권한을 부득이하게 777로 설정해야할 때,

보안때문에 우려된다면 해당 폴더에서 실행하는 html이나 php 실행을 차단하게 설정.

업로드 디렉토리에 다음 코드를 .htaccess 로 작성해서 파일을 돌리면

기재한 확장자에 대해서는 실행하지 않음.

$> vi .htaccess

<FilesMatch "\.(phtml|html|htm|ph|php|php3|php4|txt|pl|cgi|inc)">
Order allow,deny
Deny from all
</FilesMatch>

출처


아파치 트래픽 제한- CBAND 설치하기

 

  • souceforge.net에서 다운로드 ( http://sourceforge.net/projects/cband/ )

  • 내려받은 패키지 컴파일

$> cd mod-cband-0.9.7.5
$> configure --with-apxs=/usr/local/apache2/bin/apxs
$> make; make install
  • 아파치 모듈 설정여부 확인

$> vi /usr/local/apache2/conf/httpd.conf
...
LoadModule cband_module modules/mod_cband.so
...
  • 아파치 설정파일에 아래 내용 추가

$> vi /usr/local/apache2/conf/httpd.conf
...
CBandLimit 1Mi #허용할 용량, ex 100MB
CBandPeriod 1D #초기화 기준, ex 1일
SetHandler cband-status-me
SetHandler cband-status-me
SetHandler cband-status-me
Order Deny,Allow
Deny from all
Allow from 192.168.10.  #cband 접속 허용할 ip입력
...
  • 확인

    • 서버에서 /cband-stauts 폴더로 들어가면 확인 가능.

    • 초기화하려면 아파치 내렸다가 올리면 초기화 가능

    • Apache 2.x에서 CBAND를 사용하며 Apache 1.x일 경우에는 throttle을 사용하면 됨.

  • 대역폭 제한은 다음과 같이 설정

    • CBandSpeed 1024 10 30 가상호스트 도메인의 최대 속도, 요청수, 접속수 설정

    • 문법 : CBandSpeed kbps rps max_conn

    • CBandRemoteSpeed 20kb/s 3 30 접속자(IP)의 최대속도, 요청수, 접속수 제한 (CBandSpeed와 비슷하나, 접속자당 설정)

    • 문법 : CBandRemoteSpeed kbps rps max_conn

출처 - http://igoni.kr/books/linux/page/cband



웹로그 분석 Awstats 설치하기

 

Awstats설치하기

  • 다운로드 URL - https://awstats.sourceforge.io/

  • 압축풀기&툴 이동

$> tar -zxvf awstats-7.3.tar.gz
$> mv awstats-7.3 /usr/local/awstats/
  • awstats 설정

$> cd usr/local/awstats/
$> mkdir etc; mkdir logs
$> cp wwwroot/cgi-bin/awstats.model.conf ./etc/test.kr

* /usr/local/awstats/tools/awstats_configure.pl 파일로도 설정파일 생성가능합니다.

  • 설정내용

$> vi test.kr
# 원본 아파치 로그 경로설정
LogFile="/usr/local/apache2/logs/test.kr-access_log"

# 로그형태 설정
LogType=W
(웹로그=W, 메일로그=M, FTP전송로그=F)

# 로그포맷설정
LogFormat=1
(아파치로그=1, IIS로그=2)

# 사이트 메뉴에서 보일 도메인명
SiteDomain="test.kr"

# 호스트 별칭설정
HostAliases="awstats.test.kr"

# Awstats 로그 경로설정
DirData="/usr/local/awstats/logs"

# 자동업데이트 설정
EnableLockForUpdate=0
(자동업데이트=0, 수동업데이트=1)

  • 아파치 설정하기

  • *아파치 로그는 combined 형태로 저장되어 있어야 분석이 가능하며, common으로 되어 있을경우, 호환성 문제로 경고메시지 출력함.

  • 아파치 설정파일 샘플

CustomLog "logs/access_log" combined
Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"
AllowOverride all
Order allow,deny
Allow from all
Options ExecCGI

  • 레포트 출력하기 & Crontab에 추가하기

$> /usr/bin/perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=test.kr -update
$> crontab -l
* * * * * /usr/bin/perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=test.kr -update > /dev/null

출처 - http://igoni.kr/books/linux/page/awstat

Apache Benchmark 테스트

 

[root@root ~]# ab -c 1000 -n 1000 -t 10 http://localhost/

- 1000의 유저가 동시에 1000개의 페이지를 최대 10초동안 호출하는 테스트

측정결과 분석

Server Software

아파치 버전을 표시

Server Hostname

사이트의 이름

Server Port

웹서비스 사용 포트 번호

Document Path

초기 문서가 존재하는 웹문서 root위치

Time take for tests

응답시간(매우 중요한 결과 값)

Document Length

초기문서의 크기

Complete requests

요구에 응답완료한 세션 수

Failed requests

요구에 응답실패한 세션 수

Broken pipe errors

실패한 에러 수

Total transferred

총 전송 바이트 수

HTTP transferred

총 전송한 HTML 바이트 수

Requests per second

초당 응답 요구 수

Time per request

요구에 응답한 시간(단위 micro second, 중요한 결과값)

Time per request

요구에 응답한 시간

Transfer rate

초당 전송 가능한 용량

출처 - http://igoni.kr/books/linux/page/apache-benchmark



adfit

AI들끼리 대화하기

ChatGPT, perplexity, Gemini... 많은 AI 서비스가 있고 서비스별로 다양한 엔진이 있죠. 문득 AI끼리 대화를 시켜보면 어떤 대화의 흐름을 이어갈까 궁금해졌습니다. 그래서 해보았습니다. 규 칙 나(사람)은 양쪽 AI에서...