YUMSERV
Published 2022. 6. 19. 20:58
[Sentry] 도메인 연결 및 SSL 설정 DEV
반응형

* Sentry 서버의 도메인을 연결해서 사용하려면 앞단의 NGINX를 사용해서 Proxy로 docker쪽으로 넘겨줘야 합니다.

 

1. nginx 설정

# yum install nginx
# vi /etc/nginx/nginx.conf
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
worker_connections 1024;
}

http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /data/log/nginx/access_sentry_estgames_co_kr.log combined;
error_log /data/log/nginx/error_sentry_estgames_co_kr.log error;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 4096;

include /etc/nginx/mime.types;
default_type application/octet-stream;

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
#include /etc/nginx/conf.d/*.conf;

set_real_ip_from 127.0.0.1;
set_real_ip_from 10.0.0.0/8;
real_ip_header X-Forwarded-For;
real_ip_recursive on;

# SSL configuration -- change these certs to match yours
ssl_certificate /etc/nginx/ssl/sentry_test_co_kr.pem;
ssl_certificate_key /etc/nginx/ssl/sentry_test_co_kr.key;

# NOTE: These settings may not be the most-current recommended
# defaults
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:128m;
ssl_session_timeout 10m;

server {
listen 80;
server_name sentry.test.co.kr;

location / {
if ($request_method = GET) {
rewrite ^ https://$host$request_uri? permanent;
}
return 405;
}
}

server {
listen 443 ssl;
server_name sentry.test.co.kr;

proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_redirect off;

# keepalive + raven.js is a disaster
keepalive_timeout 0;

# use very aggressive timeouts
proxy_read_timeout 5s;
proxy_send_timeout 5s;
send_timeout 5s;
resolver_timeout 5s;
client_body_timeout 5s;

# buffer larger messages
client_max_body_size 5m;
client_body_buffer_size 100k;

location / {
proxy_pass http://localhost:9000;
proxy_ssl_server_name on;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Request-Id $request_id;

add_header Strict-Transport-Security "max-age=31536000";
  }
 }
}

 

2. sentry 설정

# vi sentry/sentry.conf.py
주석해제
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

# vi sentry/config.yml
system.internal-url-prefix: 'http://web:9000'
system.url-prefix: 'https://sentry.test.co.kr'

 

 

참고)

https://sentry-docs-o2paie5ivq-uc.a.run.app/server/nginx/

반응형
profile

YUMSERV

@lena04301

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!