Programming/node.js2019. 2. 20. 19:13

express 엔진의 기본값으로 보이는 ejs는 왜 도움말이 없냐..

문법들좀 보려고 하는데 도움을 안주네


그러고 보니. pug도 새로운(?) 문법으로 보였는데

ejs는 html과 동일하지만 실제로는 렌더링 언어였던 거니까

결국에는 pug 보다는 성능이 좀 나을지 몰라도 여전히 static page로 간주하진 않는다고 봐야하려나?

[링크 : https://www.npmjs.com/package/ejs]

'Programming > node.js' 카테고리의 다른 글

node.js 파비콘 설정하기  (0) 2019.02.22
node.js apache 스타일 로그  (0) 2019.02.22
pug include / ejs include  (0) 2019.02.20
node_modules include  (0) 2019.01.29
npm npx yarn bower  (0) 2019.01.28
Posted by 구차니
Programming/node.js2019. 2. 20. 18:59

pug대신 ejs를 써보는데

문득 무슨차이가 있나 궁금해지네..


둘다 include는 지원한다. 정도만 확인인가.. ㅠㅠ

[링크 : https://pugjs.org/language/includes.html]

[링크 : https://stackoverflow.com/questions/5404830/node-js-ejs-including-a-partial]

'Programming > node.js' 카테고리의 다른 글

node.js apache 스타일 로그  (0) 2019.02.22
express ejs  (0) 2019.02.20
node_modules include  (0) 2019.01.29
npm npx yarn bower  (0) 2019.01.28
node-red rpi 접속  (0) 2018.12.20
Posted by 구차니
프로그램 사용/squid2019. 2. 19. 23:56

프록시 설정하려면 귀찮은데

그걸 해소하기 위한 방법으로 게이트웨이 아이피에다가 proxy 까는 것 처럼

클라이언트 측의 설정 없이 프록시 하는 법을 찾는 중


[링크 : https://www.cyberciti.biz/tips/linux-setup-transparent-proxy-squid-howto.html]

[링크 : https://linuxtechlab.com/squid-transparent-proxy-server-complete-configuration/]


+

방화벽에서 걸러서 프록시로 던져주는 것이 컨셉인듯

[링크 : https://blog.naver.com/kazami20/56490157]


이제 웹브라우저의 도구 -> 인터넷 옵션 -> 연결 -> 랜설정 -> 사용자랜에 프록시 사용을 체크한뒤

자신의 리눅스 프락시로 ip주소를 적고 포트를 3128로 지정해주고 인터넷을 하면

이제부터 보이는 웹 사이트 화면은 먼저 프락시에서 페이지를 읽어온뒤에 윈도우 웹브라우저로

보여지는것이다.

이와 같은 브라우저에서의 프락시 설정을 하지 않고 사용하고 싶을때 패킷필터 방화벽설정을

하여서 80포트로 가는 패킷을 3128번 포트로 리다이렉트하는 방법이 있다.

이것을 Transparent Proxy(투명 프락시)라고 하는데 이것을 설정하는 것은 쉬우며

젤 아래에 설정을 추가할 부분을 추가한다.


------------ Proxy mode 로 사용시 설정 끝 -----------------------------


squid데몬 스타트

/etc/rc.d/init.d/squid start



--------------------- 투명 프락시 사용할시 ---------------------------


투명 프락시를 사용할 경우에는 내부 네트워크(192.168.0.0)가 필요하고

공인 아피를 가진 리눅스가 한대 있다고 가정하고 이 리눅스에는 랜카드가 두개 있어야한다.

즉 리눅스 gateway서버로 돌아가는 리눅스가 한대 필요하다. gateway설정은 kldp를 참조하라.

gateway설정은 잘 되어있다고 보고

아래와 같은 설정을 게이트웨이의 iptables룰에 추가한다.


혹시 모르므로 아래같은 마스크레이드 룰이 적용 안되었다면 적용해라


iptables -t nat -A POSTROUTING -p TCP -s 0/0 --dport 21 -j MASQUERADE

iptables -t nat -A POSTROUTING -p TCP -d 0/0 --dport 20 -j MASQUERADE

iptables -t nat -A POSTROUTING -p TCP --dport 25 -j MASQUERADE

iptables -t nat -A POSTROUTING -p TCP --dport 110 -j MASQUERADE

iptables -t nat -A POSTROUTING -p TCP --dport 22 -j MASQUERADE

iptables -t nat -A POSTROUTING -p TCP --dport 23 -j MASQUERADE


echo "###################################################################################"

echo "###                Transparent Proxy with Squid                  ###"

echo "### iptables -t nat -A PREROUTING -p TCP --dport 80 -j REDIRECT --to-port 3128  ###"

echo "###################################################################################"



그리고 squid.conf에 다음의 설정을 추가한다.


httpd_accel_host virtual

httpd_accel_port 80

httpd_accel_with_proxy on

httpd_accel_uses_host_header on 

[링크 : http://coffeenix.net/board_view.php?cata_code=0&bd_code=129&bpage=]

Posted by 구차니

어쩐지 오늘따라 딴짓하고 싶더라니... (응?)




+1

덧붙이자면 RAID0로 HDD 6개가 물린 볼륨이고

저번달 부터 먼가 쇠긁는 띠낑띠낑 하는 소리가 나서 어떤 놈인지 못 찾고 있었는데

오늘에서야 predictive failure 뜨면서 경고 수준의 알림이 울린 상황


+2

덧붙이자면 저 7번 드라이브가 누군지 고민때리다

패널을 보니 숫자 화살표로 표시되어서 어이 벙벙


+3

좀 더 덧붙이자면 7번 드라이브에 경고 주황색이 깜박깜박

-0- (아까 하던 내 고민은?!?!)

Posted by 구차니
하드웨어/RAID2019. 2. 19. 12:52

nested level의 RAID는 당연한 거긴 하지만..

망할(?) span 이라는 용어가 나오는데


RAID 1+0 에서

RAID0는 속도를 위해 묶이므로 안정성이 꽝이라

안정성을 보강해주기 위해 RAID0에 묶일 볼륨을 RAID1으로 미러링 해주는 구성이 된다.

그리고 안정성을 위한 span이 raid 1으로 묶이게 되고(그래서 RAID 1+0에서 1이 먼저)

용량과 속도를 위해 RAID1들을 RAID0으로 묶게 된다.


 Spanned RAID levels Spanning is a term used to describe the way in which RAID levels 10, 50, and 60 are constructed from multiple sets of basic, or simple RAID levels. For example, a RAID 10 has multiple sets of RAID 1 arrays where each RAID 1 set is considered a span. Data is then striped (RAID 0) across the RAID 1 spans to create a RAID 10 virtual disk. Similarly, RAID 50 and RAID 60 combine multiple sets of RAID 5 or RAID 6 respectively with striping.  

[링크 : http://hg.flagshiptech.com/ebay/DellManuals/rc_h310_h710_h710p_h810_ug_en-us.pdf]

[링크 : https://www.dell.com/community/PowerEdge-HDD-SCSI-RAID/RAID10-and-spans/td-p/4666979]

'하드웨어 > RAID' 카테고리의 다른 글

RAID5가 전가의 보도는 아니었구나.. 라는 실망  (2) 2019.02.24
raid 특성인가?  (0) 2019.02.22
R730 PERC RAID-0 vs RAID-5  (0) 2019.02.15
R730 RAID5 성능 테스트(?)  (0) 2019.02.13
PowerEdge RAID Controller - PERC  (0) 2019.02.12
Posted by 구차니
프로그램 사용/squid2019. 2. 18. 17:44

묘하게 비문인가. 오타인가 이해가 안되고 번역도 잘 안되고...


min / percent / max는 명시적 만료시간(explicit expiry time)이 정의되지 않은 애들에 대한 설정으로  

패킷캡쳐를 해보니 HTTP 내부에 이런 식으로 응답이 오는 걸 확인하였는데

요기에 expires나 Cache-Control : max-age 등에 값이 없을 경우에 대한 녀석으로 생각된다.

[링크 : https://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html]


usage: refresh_pattern [-i] regex min percent max [options]


By default, regular expressions are CASE-SENSITIVE.  To make

them case-insensitive, use the -i option.

>>>>>

기본적으로 정규표현식은 대소문자를 구분합니다. 대소문자를 구분하지 않으려면 -i 옵션을 사용하시기 바랍니다.


'Min' is the time (in minutes) an object without an explicit

expiry time should be considered fresh. The recommended

value is 0, any higher values may cause dynamic applications

to be erroneously cached unless the application designer

has taken the appropriate actions.

>>>>>

'Min' 명시적 만료시간이 존재하지 않는 객체에 대해 신선하다고 간주되어야 할 시간 (분단위) 입니다.

추천되는 값은 0으로, 그 이상의 값은 어플리케이션 디자이너가 적절한 행동을 취해야하지 않는다면

다이나믹 어플리케이션에서 오류가 있는 캐시를 야기할 수 있습니다.

(다이나믹 웹에서 갱신되지 않는 옛 데이터를 캐시할 수 있다?)


'Percent' is a percentage of the objects age (time since last

modification age) an object without explicit expiry time

will be considered fresh.

>>>>>

'Percent'는 명시적 만료시간이 존재하지 않는 객체에 대해 신선하다고 간주되어야 할 나이(마지막 수정일로 부터의 나이)의 비율입니다.

(나중에 나올 LM Factor 인가?)


'Max' is an upper limit on how long objects without an explicit

expiry time will be considered fresh. The value is also used

to form Cache-Control: max-age header for a request sent from

Squid to origin/parent.

>>>>>

'Max' 명시적 만료시간이 존재하지 않는 객체에 대해 신선하다고 간주되어야 할 상한선 입니다.

이 값은  Squid로 부터 origin/parent로 요청되는 양식 Cache-Control: max-age 헤더로부터 사용됩니다.


options: override-expire

override-lastmod

reload-into-ims

ignore-reload

ignore-no-store

ignore-private

max-stale=NN

refresh-ims

store-stale


override-expire enforces min age even if the server

sent an explicit expiry time (e.g., with the

Expires: header or Cache-Control: max-age). Doing this

VIOLATES the HTTP standard.  Enabling this feature

could make you liable for problems which it causes.

>>>>>

override-expire 는 서버가 명시적 만료시간을 보내더라도 min age를 강제합니다.(예 Expires: header 혹은 Cache-Control: max-age).

이것은 HTTP 표준을 위반합니다. 이 기능을 활성화 시키면 그것으로부터 야기되는 문제들에 대해 책임을 져야합니다.


Note: override-expire does not enforce staleness - it only extends

freshness / min. If the server returns a Expires time which

is longer than your max time, Squid will still consider

the object fresh for that period of time.

>>>>>

알림 : override-expire는 부패를 강제 하지 않습니다 - 단지 신선함에 대한 min 시간을 늘립니다.

당신의 최고 시간보다 긴 만료시간을 서버가 보낸다면, Squid는 그 기간 동안은 신선함으로 판단할 것입니다.


override-lastmod enforces min age even on objects

that were modified recently.

>>>>>

override-lastmod는 최근 수정되었다 하더라도 객체에서 min 값을 강제합니다.


reload-into-ims changes a client no-cache or ``reload''

request for a cached entry into a conditional request using

If-Modified-Since and/or If-None-Match headers, provided the

cached entry has a Last-Modified and/or a strong ETag header.

Doing this VIOLATES the HTTP standard. Enabling this feature

could make you liable for problems which it causes.

>>>>>

reload-into-ims는 클라이언트의 Cache-Control : no-cache나 

캐시된 항목을 위해 요청되는 

캐쉬된 항목이 지니는 Last-Modified 와/나 강력한 ETag 헤더에 의해 제공되는

IMS(If-Modified-Since) 와/나 INM(If-None-Match) 헤더들로 부터의

조건부 요청에 의한 reload 요청을 변화합니다.


ignore-reload ignores a client no-cache or ``reload''

header. Doing this VIOLATES the HTTP standard. Enabling

this feature could make you liable for problems which

it causes.

>>>>>

ignore-reload는 클라이언트의 no-cache나 reload 헤더를 무시합니다.

이것은 HTTP 표준을 위반합니다. 이 기능을 활성화 시키면 그것으로부터 야기되는 문제들에 대해 책임을 져야합니다.


ignore-no-store ignores any ``Cache-control: no-store''

headers received from a server. Doing this VIOLATES

the HTTP standard. Enabling this feature could make you

liable for problems which it causes.

>>>>>

ignore-no-store는 서버로 부터 받아지는 어떠한 'Cache-control: no-store' 헤더도 무시하도록 합니다.

이것은 HTTP 표준을 위반합니다. 이 기능을 활성화 시키면 그것으로부터 야기되는 문제들에 대해 책임을 져야합니다.


ignore-private ignores any ``Cache-control: private''

headers received from a server. Doing this VIOLATES

the HTTP standard. Enabling this feature could make you

liable for problems which it causes.

>>>>>

ignore-private는 서버로 부터 받아지는 어떠한 'Cache-control: private' 헤더도 무시하도록 합니다.

이것은 HTTP 표준을 위반합니다. 이 기능을 활성화 시키면 그것으로부터 야기되는 문제들에 대해 책임을 져야합니다.


refresh-ims causes squid to contact the origin server

when a client issues an If-Modified-Since request. This

ensures that the client will receive an updated version

if one is available.

>>>>>

refresh-ims는 클라이언트가 IMS(If-Modified-Since) 요청을 발행하였을때 원본 서버로 부터 squid의 접속을 발생하도록 합니다.

이것은 클라이언트가 가능하다면 업데이트 된 버전을 받도록 보장합니다.


store-stale stores responses even if they don't have explicit 

freshness or a validator (i.e., Last-Modified or an ETag) 

present, or if they're already stale. By default, Squid will 

not cache such responses because they usually can't be

reused. Note that such responses will be stale by default.

>>>>>

store-stale 는 명시적인 신선함이나 감별자 (예로 Last-Modified 혹은 ETag)존재가 없거나 혹은 그것들이 이미 신선하지 않더라도 응답을 저장합니다.

그것들이 대부분 재사용될 수 없기 때문에, 기본적으로 Squid는 이러한 응답들을 캐시하지 않을 것입니다.


max-stale=NN provide a maximum staleness factor. Squid won't

serve objects more stale than this even if it failed to

validate the object. Default: use the max_stale global limit.

>>>>>

max-stale=NN은 최대 부패 요소를 제공합니다. Squid는 객체를 입증하는데 실패하더라도, 이 값 보다 더 부패한 객체에 대해서 제공하지 않을 것입니다. 

기본값 : max_stale 전역 제한을 사용합니다.


결론 : 번역해서 먼소리인지 모르겠다!!!!


+

HTTP 프로토콜을 들여다 보게 될 줄이야 ㅠㅠ

전부 Cache-Control 하위 설정들이었구나..

캐시 요청 디렉티브

Cache-Control: max-age=<seconds>

Cache-Control: max-stale[=<seconds>]

Cache-Control: min-fresh=<seconds>

Cache-control: no-cache 

Cache-control: no-store

Cache-control: no-transform

Cache-control: only-if-cached 

[링크 : https://developer.mozilla.org/ko/docs/Web/HTTP/Headers/Cache-Control]

'프로그램 사용 > squid' 카테고리의 다른 글

HSTS-HTTP Strict Transport Security / squid  (0) 2019.02.25
squid as transparent proxy  (0) 2019.02.19
squid LM-factor? (Last Modified)  (0) 2019.02.18
squid access log 종류..  (2) 2019.02.17
mrtf centos  (0) 2019.02.14
Posted by 구차니
Programming/angular2019. 2. 18. 17:09

아래와 같은 에러가 발생을 하면서 ie로 확인하면 안되는 경우 

SCRIPT5022: 예외가 발생했지만 catch할 수 없습니다.

polyfills.-------------.bundle.js (1,57771) 


요렇게 하면 된다더라.. (라고 발빼기)

src\polyfills.ts :


/** IE9, IE10 and IE11 requires all of the following polyfills. **/

import 'core-js/es6/symbol';

import 'core-js/es6/object';

import 'core-js/es6/function';

import 'core-js/es6/parse-int';

import 'core-js/es6/parse-float';

import 'core-js/es6/number';

import 'core-js/es6/math';

import 'core-js/es6/string';

import 'core-js/es6/date';

import 'core-js/es6/array';

import 'core-js/es6/regexp';

import 'core-js/es6/map';

import 'core-js/es6/set'; 

[링크 : https://stackoverflow.com/questions/45353619/angular4-application-running-issues-in-ie11]


링크에 의하면 기본값으로 IE9~IE11 호환을 하지 않도록 되어 있어서 발생하는 것으로 추측된다.

'Programming > angular' 카테고리의 다른 글

angular 빌드 최적화(?)  (0) 2019.03.18
angular with reverse proxy  (0) 2019.03.18
angular proxy  (0) 2018.11.02
vscode 및 angular.js 셋팅..  (0) 2018.08.08
Posted by 구차니
프로그램 사용/squid2019. 2. 18. 10:56

이건 또 언제보냐..

일단 뒤에 squid 번역해 보고 나니 조금 이해 되는 듯 한데

이해한 걸 적자면.. ILM(If-Last-Modified) 으로 설정되었을 경우

(현재 시간 - LastModified 시간) * Percent(Squid에서 설정되는 그 값)가 Fresh 하다고 간주되는 시간이다.

근데... 현재 시간이 그럼 늦게 접속하면.. 오랜시간 동안 변하지 않았으니

Fresh로 오랫동안 간주해도 된다는 의미인가?

2019/02/18 - [프로그램 사용/squid] - 끄으으응.. squid 번역을 한번 했어야 했나.. refresh_pattern


The response is stale if the response age is greater than the refresh_pattern max value.

refresh_pattern max 값 보다 응답 시간이 클 경우 응답은 부패한 것 으로 간주합니다.


The response is fresh if the LM-factor is less than the refresh_pattern percent value.

refresh_pattern percent 값 보다 LM-factor가 적을 경우 응답은 신선한 것 으로 간주합니다.


The response is fresh if the response age is less than the refresh_pattern min value.

refresh_pattern min 값 보다 응답 시간이 적을 경우 응답은 신선한 것 으로 간주합니다.


Otherwise, the response is stale.

그 외에는 응답은 부패한 것으로 간주합니다. 


override-expire

When set, this option causes Squid to check the min value before checking the Expires header. Thus, a non-zero min time makes Squid return an unvalidated cache hit even if the response is preexpired.

이 옵션은 Squid가 Expire 헤더를 확인하기 전에 min 값을 확인하도록 설정합니다. 그러므로 0이 아닌 min 값은 Squid가 응답이 만료되기 전이라도 캐시 적중을 무효화 하게 됩니다.


override-lastmod

When set, this option causes Squid to check the min value before the LM-factor percentage.

이 옵션은 Squid가 LM-factor 퍼센트 보다 먼저 min 값을 확인하도록 설정합니다.


reload-into-ims

When set, this option makes Squid transform a request with a no-cache directive into a validation (If-Modified-Since) request. In other words, Squid adds an If-Modified-Since header to the request before forwarding it on. Note that this only works for objects that have a Last-Modified timestamp. The outbound request retains the no-cache directive, so that it reaches the origin server.

이 옵션은 Squid가 no-cache 지시어가 있는 요청을 유효한 (IMS If-Modified-Since)요청으로 변환하도록 설정합니다. 다르게 말하자면, Squid는 IMS(If-Modified-Since) 헤더를 덧붙여서 전달합니다. 이 설정은 Last-Modified 타임스탬프가 존재하는 객체에 대해서만 작동합니다. 

아웃바운드 요청은 no-cache 지시어를 유지하며, 원본 서버에 도달하게 됩니다.


ignore-reload

When set, this option causes Squid to ignore the no-cache directive, if any, in the request.

이 옵션은 Squid가 no-cache 지시어를 무시하도록 설정합니다. 

[링크 : http://etutorials.org/.../Chapter+7.+Disk+Cache+Basics/7.7+refresh_pattern/]

'프로그램 사용 > squid' 카테고리의 다른 글

squid as transparent proxy  (0) 2019.02.19
끄으으응.. squid 번역을 한번 했어야 했나.. refresh_pattern  (0) 2019.02.18
squid access log 종류..  (2) 2019.02.17
mrtf centos  (0) 2019.02.14
squid cache hit rate 올리기  (0) 2019.02.14
Posted by 구차니
프로그램 사용/squid2019. 2. 17. 20:32

일단 쓰면서 보면 제일 눈에 많이 띄는건 아래의 녀석들인데..


TCP_MISS

TCP_INM_HIT

TCP_MEM_HIT

TAG_NONE


HIER_DIRECT

HIER_NONE


HIT는 HIT인데 나머지는 감이 안온다.. ㅠㅠ

찾아도 왜이렇게 안보일까...?

'프로그램 사용 > squid' 카테고리의 다른 글

끄으으응.. squid 번역을 한번 했어야 했나.. refresh_pattern  (0) 2019.02.18
squid LM-factor? (Last Modified)  (0) 2019.02.18
mrtf centos  (0) 2019.02.14
squid cache hit rate 올리기  (0) 2019.02.14
squid 비디오 차단  (0) 2019.02.13
Posted by 구차니

아.. 망했다.. ㅠㅠ

[링크 : https://www.medo64.com/2010/12/extracting-sparse-tar/]

'프로그램 사용 > kvm(virt-manager)' 카테고리의 다른 글

virsh domstats 로 가상머신의 cpu 사용율 확인하기  (0) 2019.03.29
kvm snapshot  (0) 2019.03.17
sparse file nfs /smb  (0) 2019.02.15
virsh create / define  (0) 2019.02.15
kvm 설치  (4) 2019.02.15
Posted by 구차니