본문 바로가기

반응형

nginx

[리눅스] NGING에서 PHP-FPM 상태를 활성화하고 모니터링하는 방법 NGING에서 PHP-FPM 상태를 활성화하고 모니터링하는 방법 nginx 설정 vim /etc/nginx/conf.d/default.conf $ vim /etc/nginx/conf.d/default.conf ... # nginx, php-fpm status location ~ ^/(status|ping)$ { fastcgi_pass unix:/run/php-fpm/php-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_index index.php; include fastcgi_params; allow 127.0.0.1; allow 10.11.0.0/16; allow 10.21.0.0/16; allow .. 더보기
[리눅스] NGINX 및 PHP-FPM access logs 설정 NGINX 및 PHP-FPM 액세스 로그 설정 nginx access logs format $ vim /etc/nginx/nginx.conf ... log_format main '$http_x_forwarded_for - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$remote_addr"' ' REQ_TIME: $request_time s - CONNECT_TIME: $upstream_connect_time s - PHP-FPM_STATUS: $upstream_status'; $ nginx -t nginx: the configuration file /etc/ng.. 더보기
NGINX에서 POST 데이터를 액세스 로그에 기록하는 방법 POST 데이터를 NGINX 액세스 로그에 기록하는 방법 NGINX에서 POST 데이터를 액세스 로그에 기록하려면 log_format 디렉티브를 사용하여 로그 형식을 정의하고 $request_body 변수를 포함시키면 됩니다. 다음은 POST 데이터를 액세스 로그에 기록하는 예시입니다. 1. nginx 설정 파일 (nginx.conf 또는 사이트 구성 파일)을 엽니다. 2. http 블록 내에 있는 log_format 디렉티브를 찾습니다. 만약 log_format 디렉티브가 없다면 새로 추가해야 합니다. 3. 다음과 같이 log_format 디렉티브를 정의하고 $request_body 변수를 사용하여 POST 데이터를 포함시킵니다. http { log_format custom_log '$remote_ad.. 더보기
[NGINX] nginx limit_conn | limit_req 모듈 사용하기 nginx limit_conn | limit_req 모듈 사용하기 nginx limit_conn 모듈 $ vim /etc/nginx/nginx.conf http { ... limit_conn_zone $http_x_forwarded_for zone=ddos_conn:10m; limit_conn_zone $server_name zone=rate_conn:10m; limit_conn_log_level info; limit_conn_status 571; ... } $ vim /etc/nginx/conf.d/default.conf server { listen 80; ... limit_conn ddos_conn 1; ... } nginx limit_req 모듈 $ vim /etc/nginx/nginx.conf h.. 더보기
웹 서버에서 HSTS(HTTP Strict Transport Security)를 설정하는 방법 웹 서버에서 HSTS(HTTP Strict Transport Security)를 설정하는 방법 HSTS(Strict Transport Security)는 웹 사이트의 보안을 강화하기 위한 메커니즘 중 하나로, HTTPS를 통해 통신하는 것을 강제하고 중간자 공격을 방지하는 기능을 제공합니다. HSTS를 설정함으로써 클라이언트(웹 브라우저)는 지정된 기간 동안 해당 웹 사이트와의 모든 통신을 HTTPS를 통해서만 수행하도록 강제됩니다. Redirect HTTP connections to HTTPS Apache 설정 ServerName example.com RewriteEngine on RewriteCond %{HTTPS} !on RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [.. 더보기
nginx-module-vts 모듈 추가 Nginx 가상호스트 트래픽 상태 모듈 설치하기 nginx-module-vts는 서버 상태 및 성능 통계를 제공하는 Nginx 모듈입니다. APT 저장소 설정 sudo sed -Ei 's/(archive|security)\.ubuntu\.com/mirror.kakao.com/g' /etc/apt/sources.list apt-get update APT 패키지툴을 이용하여 nginx 설치 apt-get install -y curl gnupg2 ca-certificates lsb-release echo "deb http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list curl -f.. 더보기
[리눅스] nginx + tomcat(멀티 인스턴스) 설치 nginx + tomcat(멀티 인스턴스) 설치 1. nginx 설치 yum install pcre-devel zlib-devel openssl-devel mkdir /app cd /app/ tar xvfz nginx-1.10.3.tar.gz cd nginx-1.10.3 ./configure --prefix=/app/nginx --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module make && make install cd /app/nginx/sbin/ /app/nginx/sbin/nginx ps -ef | grep nginx $ ps -ef | grep nginx root 12446 1 0 17:33 ? 0.. 더보기
nginx upstream 블록의 주요 옵션과 사용법 nginx upstream 블록의 주요 옵션과 사용법 nginx에서 upstream 블록을 사용하는 것은 로드 밸런싱 및 업스트림 서버 관리에 도움을 줍니다. upstream 블록은 여러 웹 서버나 애플리케이션 서버로의 요청을 분산하거나 백엔드 서버 그룹을 정의하는 데 사용됩니다. 로드 밸런싱 방법(Load balancing methods) round-robin : 응용 프로그램 서버에 대한 요청은 라운드 로빈(round-robin) 방식으로 배포됩니다 least-connected : 다음 요청은 활성 연결 수가 가장 적은 서버에 할당됩니다(the least number of active connections). ip_hash : 다음 요청에 대해 어떤 서버를 선택해야 하는지 결정하는 데 해시 함수가 사.. 더보기

728x90
반응형