리눅스 102

nginx 특정 method 리다이렉트

DELETE라는 메소드로 /v2/reviews/ 에 요청이 올시 https://aaa.aaa.com;로 넘겨라 라는 내용의 설정이다. location ~ ^/v2/reviews/((.*))$ { if ($request_method = DELETE ) { proxy_pass https://aaa.aaa.com; } rewrite ^/v2/reviews/(.*)$ /v2/reviews/$1 break; proxy_set_header Host $proxy_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_ssl_server_name on; proxy_ssl_..

리눅스/Nginx 2022.04.12

htaccess 파일로 암호걸기

# vi .htaccess AuthType Basic AuthName "내로그아무나못봐" AuthUserFile /usr/local/awstats/wwwroot/.htpasswd require valid-user # chmod 777 .htaccess `.htaccess'의 모드를 0777(rwxrwxrwx)으로 변경하였습니다 암호파일 생성하기 (사용자 추가) # /usr/local/apache/bin/htpasswd -c .htpasswd harulife New password: Re-type new password: Adding password for user harulife 진행후 .htpasswd 파일에 pass:AeSbyDhAJWi9o

리눅스/apache 2021.06.07

대용량sql 덤프파일에서 특정 테이블 추출하기

대용량 덤프파일에서 table 단위로 추출해야할 때가 있다. db를 만들어서 해당 데이터를 밀어넣은뒤 특정 테이블만 빼내어 작업하는경우도 있긴하지만... sql 파일 자체에서 sed 명령어로 해당 테이블에 대한 데이터만 빼내는 방법이 있다. 아래와 같이 이용하면된다. sed -n -e '/DROP TABLE.*테이블명/,/UNLOCK TABLES/p' 디비명.sql > 디비명.테이블명.sql ex) sed -n -e '/DROP TABLE.* harulife_test /,/UNLOCK TABLES/p' 20210202_harulife.sql > harulife_test.sql 위와같이 명령어를 통해 harulife_test 테이블을 20210202_harulife.sql(harulife_DB)에서 추출한..

리눅스/mysql 2021.02.03

zabbix 5.2 agent 설치

1. 설치할 repo를 가져온다. # wget http://repo.zabbix.com/zabbix/5.2/rhel/7/x86_64/zabbix-release-5.2-1.el7.noarch.rpm 2. repo를 적용시켜준다. # rpm -ivh zabbix-release-5.2-1.el7.noarch.rpm 3. zabbix-agent를 설치한다. # yum install zabbix-agent 4. zabbix.conf 파일을 수정한다. #vi /etc/zabbix/zabbix_agentd.conf Server=(zabbix-server IP) Hostname=(zabbix-agent IP) 5. 서비스 등록 및 시작 #systemctl enable zabbix-agent #systemctl star..

리눅스/기타 2021.01.26

zabbix 5.2 그래프 한글깨짐

처음 자빅스를 설치하고 그래프를 볼때 위와같이 한글이 깨지는 경우가 확인됩니다. 1. 일반 폰트를 다운로드 받는다. # cd /usr/local/src # wget http://cdn.naver.com/naver/NanumFont/fontfiles/NanumFont_TTF_ALL.zip 2. 압축을 풀어준다. # unzip NanumFont_TTF_ALL.zip 3. 풀어진 폰트에서 원하는 폰트를 하나 지정하여 소스파일경로로 옮긴다. # mv NanumGothic.ttf /home/zabbix/public_html/assets/fonts # cd /home/zabbix/public_html/assets/fonts 4. 실질적으로 DejaVuSans.ttf 파일이 적용되는 파일이므로 이름명을 서로 바꿔준다..

리눅스/기타 2021.01.26

오픈소스 모니터링 zabbix 5.2 소스설치

1.apache,php,mysql 을 설치해준다. 저같은경우는 apache,php,mysql을 소스설치하여 구성하였습니다. (apache2.4, php7.4,mysql5.7) 2. 필수 라이브러리 설치 #yum -y install \ gcc* \ make \ libtool-ltdl-devel \ openssl-devel \ pcre-devel \ ncurses-devel \ libxml2-devel \ bzip2 \ bzip2-devel \ curl-devel \ gdbm-devel \ libjpeg-devel \ libpng-devel \ freetype-devel \ imap-devel \ libc-client-devel \ krb5-devel \ libmcrypt \ libmcrypt-devel \..

리눅스/기타 2021.01.25

mysql 패스워드 분실, 재설정

MySQL 5.7.9 버젼 설치 후 root 접속 시도 시 패스워드 장애로 MySQL 접속이 안될때 #/etc/init.d/mysql stop #/usr/local/mysql/bin/mysqld_safe --skip-grant-tables & #mysql -u root update mysql.user set password=password('패스워드') where user='root'; 콘솔 윈도우에서 mysqld_safe 실행으로 safe 모드로 MySQL 데몬을 구동하고 다른 콘솔 윈도우를 띄어 MySQL에 접속한다. #mysql -u root -p 접속 후 다음 명령어로 root 비밀번호를 업데이트한다. [5.7 이전 버젼] update mysql.user set password=password('..

리눅스/mysql 2021.01.11

php 쿼리로 호출해보기.

define("DB_HOST", "IP주소");define("DB_USER", "호출할DB유저명");define("DB_PASSWORD", "유저패스워드");define("DB_NAME", "DB명");define("DB_PORT", "DB 포트"); $conn = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT);$query = "호출해볼 쿼리명 적어넣기";ex) $query = "CALL SP_STATS_all ('ilsan', '2020-01-01', '2020-12-10', '', '', 'Y', 'Y', 'Y', 'Y', '', '', '', '', '', '', '', '', '', '', '', '', '', '..

리눅스/php 2021.01.06

./configure: error: the HTTP XSLT module requires the libxml2/libxsltlibraries. You can either do not enable the module or install the libraries.

nginx 설치를 진행하다 오류가 발생했다. ./configure: error: the HTTP XSLT module requires the libxml2/libxsltlibraries. You can either do not enable the module or install the libraries. 위와같은 error 발생시 yum -y install libxslt-devel 설치 완료후 다시 컴파일을 하면 해당오류는 넘어갈수있다.

리눅스/php 2020.11.03

snmp 소스설치

snmp 최신버전을 다운받는다 http://sourceforge.net/project/showfiles.php?group_id=12694&package_id=11571 [ net-snmp - Browse /net-snmp at SourceForge.net × sourceforge.net ](http://sourceforge.net/project/showfiles.php?group_id=12694&package_id=11571) #tar zxvf net-snmp-5.9.tar.gz #cd net-snmp-5.9 #./configure --prefix=/usr/local/snmp ## 도중 나오는 과정은 전부 enter ## #make && make install ## snmpd.conf 파일이없으므로 하나..

리눅스/기타 2020.09.29

apache-tomcat 연동 및 로드벨런싱

apache 2.4 tomcat 8.5.56 1. apache 2.4 설치 http://httpd.apache.org/download.cgi 에서 다운로드 2. JAVA 설치 https://www.oracle.com/java/technologies/javase-downloads.html 에서 다운로드 3. tomcat 8.5.56 설치 https://tomcat.apache.org/download-80.cgi 다운로드 4. apache mod_jk 설치 http://tomcat.apache.org/download-connectors.cgi 해당 링크에서 tomcat-connetors 다운로드 한뒤 apache 모듈 추가 5. apache conf 설정 #vi httpd.conf LoadModule jk_..

리눅스/apache 2020.09.16

postgres12 ha 구성방법

설치 환경 10.1.0.4 master 10.1.0.5 slave 1. 서로간 연결 설정(master_server) #vi postgresql.conf listen_addresses = '*' 위와같이 수정한다. 2. 리플리케이션 유저 생성(master_server) #su – postgres $ createuser --replication -P -e replicator 3.slave서버를 연결할 설정을 해준다.(master_server) $vi pg_hba.conf host replication replicator 10.1.0.5/24 md5 4.master 서버의 데이터를 가져온다(slave_server) $pg_basebackup -h 10.1.0.4 -D /home/postgres/pgsql/da..

리눅스/기타 2020.09.15

postgresql 소스설치

postgreSQL 다운로드 다운로드는 공식 홈페이지인 https://www.postgresql.org/download/ 받을 수 있습니다. 또는 아래처럼 wget 명령어를 사용하여 다운로드 받을 수도 있습니다. [root@Centos7 ~]# wget https://ftp.postgresql.org/pub/source/v9.4.0/postgresql-9.4.0.tar.gz limits.conf 파일에 내용 추가 /etc/security/limits.conf 파일을 수정합니다. 아래처럼 postgres 사용자에 대한 설정 값을 입력해줍니다. [root@Centos7 ~]# vi /etc/security/limits.conf postgres soft nofile 65535 postgres hard nofi..

리눅스/기타 2020.09.07