반응형

Apache server-status 설정 후 Apache 재시작

httpd.conf
ExtendedStatus on
<Location /server-status>
    SetHandler server-status
    Require host .test.kr
    Require ip 172.21
</Location>

$ ./apachectl restart

Apache exporter 다운로드 및 설치

다운로드 페이지: https://github.com/Lusitaniae/apache_exporter/releases/tag/v0.11.0
wget https://github.com/Lusitaniae/apache_exporter/releases/download/v0.11.0/apache_exporter-0.11.0.linux-amd64.tar.gz
$ tar -zxvf apache_exporter-0.11.0.linux-amd64.tar.gz

Apache exporter 시작

$  /SW/prometheus/apache_exporter-0.11.0.linux-amd64/apache_exporter  --scrape_uri=http://localhost/server-status/?auto
 curl http://localhost/server-status/?auto 명령어를 수행하여 apache status를 정상적으로 불러오는지 확인 필요

 

Prometheus 다운로드 및 설치

다운로드 페이지: https://prometheus.io/download/$ wget https://github.com/prometheus/prometheus/releases/download/v2.38.0/prometheus-2.38.0.linux-amd64.tar.gz
$
 tar -zxvf prometheus-2.38.0.linux-amd64.tar.gz

Prometheus 환경파일 수정(apache-exporter 설정)

prometheus.yml
# my global config
global:
  scrape_interval:     15s # By default, scrape targets every 15 seconds.
  evaluation_interval: 15s # By default, scrape targets every 15 seconds.
 
  external_labels:
    monitor: 'www.test.kr'
 
rule_files:
 
scrape_configs:
  # ...
  - job_name: 'apache-exporter'
    scrape_interval: 5s
 
    static_configs:
      # httpd(apache), apache-exporter 설치된 인스턴스 IP:9117
      - targets: ['localhost:9117']

Prometheus 시작

$ /SW/prometheus/prometheus-2.38.0.linux-amd64/prometheus

 

Grafana 다운로드 및 설치

다운로드 페이지: https://grafana.com/grafana/download?pg=get&plcmt=selfmanaged-box1-cta1wget https://dl.grafana.com/enterprise/release/grafana-enterprise-9.1.5.linux-amd64.tar.gz

Grafana 시작

$ cd grafana-9.1.5
$ /SW/grafana/grafana-9.1.5/bin/grafana-server

 

Grafana 대시보드 적용

-계정/패스워드: admin/admin
-Apache 대시보드 json파일을 다운받아 적용한다.
https://grafana.com/grafana/dashboards/3894-apache/

 

Dashboards → + import → Upload JSON file(apache_rev7.json)

Grafana Apache 대시보드 적용 화면

-설치파일 다운로드(https://www.apachelounge.com/download/)

httpd-2.4.43-win64-VS16.zip

 

-압축 해제 후 설치경로로 이동 또는 복사
 > httpd-2.4.43-win64-VS16.zip 압축해제 후 하위의 Apache24 폴더 설치 경로로 복사

-관리자 권한 CMD 접속

-기본 설치
cd D:\Apache24\bin
httpd.exe -k install 

-이름 및 환경파일 지정
httpd.exe -k install -n apache-test -f D:\Apache24\conf\test-httpd.conf

패키지 설지

yum -y install gcc*
yum -y install libtool*
yum -y install expat-devel

1.pcre 설치
cd /FILES/apache
wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
tar -zxvf /FILES/apache/pcre-8.43.tar.gz
cd pcre-8.43
./configure --prefix=/SW/package/pcre-8.43
make && make install

2.apr 설치
cd /FILES/apache
wget http://archive.apache.org/dist/apr/apr-1.6.5.tar.gz
tar -zxvf apr-1.6.5.tar.gz
cd apr-1.6.5
./configure --prefix=/SW/package/apr-1.6.5
make && make install

3.apr-util 설치
cd /FILES/apache
wget http://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz
tar -zxvf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure --prefix=/SW/package/apr-util-1.6.1 --with-apr=/SW/package/apr-1.6.5
make && make install

4.openssl 설치
cd /FILES/apache
wget https://www.openssl.org/source/openssl-1.1.1b.tar.gz
tar -zxvf openssl-1.1.1b.tar.gz
cd openssl-1.1.1b
./config--prefix=/SW/package/openssl-1.1.1b
make && make install

5.apache 설치
cd /FILES/apache
wget http://mirror.apache-kr.org/httpd/httpd-2.4.39.tar.gz
tar -zxvf httpd/httpd-2.4.39.tar.gz
cd httpd-2.4.39
----------------------------------------------------------------
# prefork(Process 방식) 설치 #
"./configure" \
"--prefix=/SW/apache/apache-2.4.39" \
"--with-apr=/SW/package/apr-1.6.5" \
"--with-apr-util=/SW/package/apr-util-1.6.1" \
"--with-pcre=/SW/package/pcre-8.43" \
"--with-ssl=/SW/package/openssl-1.1.1b" \
"--with-expat" \
"--enable-ssl" \
"--enable-sockets" \
"--enable-mods-shared=all" \
"--enable-module=so" \
"--enable-shared=max" \
"--enable-rewrite"

# mpm(Thread 방식) 설치 #
"./configure" \
"--prefix=/SW/apache/apache-2.4.39" \
"--with-apr=/SW/package/apr-1.6.5" \
"--with-apr-util=/SW/package/apr-util-1.6.1" \
"--with-pcre=/SW/package/pcre-8.43" \
"--with-ssl=/SW/package/openssl-1.1.1b" \
"--with-expat" \
"--with-mpm=MPM" \ 
"--enable-ssl" \
"--enable-sockets" \
"--enable-mods-shared=all" \
"--enable-module=so" \
"--enable-shared=max" \
"--enable-rewrite"
----------------------------------------------------------------
make && make install

6.tomcat connector 설치
yum -y install perl
cd /FILES/apache
wget http://apache.tt.co.kr/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.46-src.tar.gz
tar -zxvf tomcat-connectors-1.2.46-src.tar.gz
./configure --with-apxs=/SW/apache/apache-2.4.39/bin/apxs
make && make install

wokers..properties에 worker.xxx.fail_on_status=503 설정 추가

각 node에 설정하거나, templete에 설정

workers.properties
#worker.list=jk-status
#worker.jk-status.type=status
#worker.jk-status.read_only=true
 
#worker.list=jk-manager
#worker.jk-manager.type=status
 
worker.list=balancer
worker.balancer.type=lb
worker.balancer.balance_workers=node1,node2
worker.balancer.error_escalation_time=0
worker.balancer.max_reply_timeouts=10
worker.balancer.sticky_session=true
#worker.balancer.method=Session
 
worker.node1.reference=worker.template
worker.node1.host=192.168.0.112
worker.node1.port=9109
worker.node1.route=test_server11
worker.node1.activation=A
worker.node1.fail_on_status=503
 
worker.node2.reference=worker.template
worker.node2.host=192.168.0.112
worker.node2.port=9209
worker.node2.route=test_server12
worker.node2.activation=A
worker.node2.fail_on_status=503
 
worker.template.type=ajp13
worker.template.socket_connect_timeout=5000
worker.template.socket_keepalive=true
worker.template.ping_mode=A
worker.template.ping_timeout=10000
worker.template.connection_pool_minsize=0
worker.template.connection_pool_timeout=600
worker.template.reply_timeout=300000
worker.template.recovery_options=3
#worker.template.fail_on_status=503

 

Wildfly, Jboss 연동 시 세션 중복처리가 가능한 상태로 설정해야 한다.

 

standalone-ha.xml

(변경 전)

standalone-ha.xml
<subsystem xmlns="urn:jboss:domain:infinispan:7.0">
   <cache-container name="web" default-cache="dist" module="org.wildfly.clustering.web.infinispan">
        <transport lock-timeout="60000"/>
        <distributed-cache name="dist">
            <locking isolation="REPEATABLE_READ"/>
            <transaction mode="BATCH"/>
            <file-store/>
        </distributed-cache>
    </cache-container>

 

(변경 후 - locking isolation, transaction mode 태그 삭제)

standalone-ha.xml
<subsystem xmlns="urn:jboss:domain:infinispan:7.0">
    <cache-container name="web" default-cache="dist" module="org.wildfly.clustering.web.infinispan">
        <transport lock-timeout="60000"/>
        <distributed-cache name="dist">
            <file-store/>
        </distributed-cache>
    </cache-container>

 

'IT기술노트 > WEB' 카테고리의 다른 글

Windows Apache 설치  (4) 2024.10.31
Linux Apache 컴파일 설치(CentOS7)  (2) 2024.10.31
Apache/Jbcs 서버 헤더 변경 방법  (3) 2024.10.31
Nginx 설치 테스트(ubuntu20.04)  (2) 2024.10.29
Nginx SSL 인증서 설정 방법  (2) 2024.10.29

Apache 설정

1)httpd.conf 파일 수정
 -mod_security2.so 모듈이 존재해야 한다
 -SecServerSignature의 설정 값 _ 으로 server 헤더가 표시된다

conf/httpd.conf
LoadModule security2_module modules/mod_security2.so
<IfModule security2_module>
  SecRuleEngine on
  ServerTokens Full
  ServerSignature Off
  SecServerSignature "_"
</IfModule>

 

Jbcs 설정

1)conf.modules.d/10-mod_security.conf 파일에 security2_module 설정 확인

conf.modules.d/10-mod_security.conf
LoadModule security2_module modules/mod_security2.so


2)httpd.conf 파일 수정
 -Include conf.modules.d/*.conf 태그 아래에 설정해야 한다.

conf/httpd.conf
Include conf.modules.d/*.conf
...
<IfModule security2_module>
   SecRuleEngine on
   ServerTokens Full
   ServerSignature Off
   SecServerSignature "_"
</IfModule>

 -ServerTokens Prod 설정 시 SecServerSignature 설정에 공백("abc test")이 포함되면 정상적으로 동작하지 않는다 (ServerTokens Prod의 기본 결과값으로 출력됨)

Apache
[httpd-ssl.conf]

   SSLCertificateFile        /SW/apache2.4/ssl/topspin_kr.crt
   SSLCertificateKeyFile     /SW/apache2.4/ssl/topspin_kr.key
   SSLCertificateChainFile   /SW/apache2.4/ssl/topspin_kr-bundle.crt


Nginx
(CRT 인증서 파일 통합)
$ cat topspin_kr.crt topspin_kr-bundle.crt > nginx_topspin_kr.crt
[nginx.conf]

  ssl_certificate      nginx_topspin_kr.crt;
  ssl_certificate_key  topspin_kr.key;

 

+ Recent posts