Skip to content

Commit

Permalink
Merge pull request #84 from woowacourse-teams/be/feat/#79-optimize-ng…
Browse files Browse the repository at this point in the history
…inx-config

[BE-FEAT] Nginx 설정 최적화
  • Loading branch information
dwax1324 authored Jul 25, 2024
2 parents 66ee121 + 8a4b6ab commit 578544e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
29 changes: 18 additions & 11 deletions backend/pokerogue/docker/nginx/conf.d/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,44 +1,51 @@
upstream was {
server http://server:8080;
keepalive 32;
}

server {
listen [::]:80 default_server;
root /var/www/html;
server_name _;
listen 80 default_server;

location / {
resolver 8.8.8.8 ipv6=off;
proxy_pass http://server:8080;
proxy_pass http://was;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;

proxy_http_version 1.1;
proxy_set_header Connection "";
}
}

server {
root /var/www/html;
server_name pokerogue-helper.com;
listen 443 ssl;

location / {
resolver 8.8.8.8 ipv6=off;
proxy_pass http://server:8080;
proxy_pass http://was;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;

proxy_http_version 1.1;
proxy_set_header Connection "";
}

listen [::]:443 ssl ipv6only=on;
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/pokerogue-helper.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/pokerogue-helper.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}

server {
server_name pokerogue-helper.com;
listen 80 ;

if ($host = pokerogue-helper.com) {
return 301 https://$host$request_uri;
}

listen 80 ;
listen [::]:80 ;
server_name pokerogue-helper.com;
return 404;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@
import lombok.RequiredArgsConstructor;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/*
추후 production에서는 제외되어야 함.
( @Profile 사용 )
*/
@Component
@Transactional
@Profile("local-mysql")
@RequiredArgsConstructor
public class DatabaseInitializer implements ApplicationRunner {

Expand Down
2 changes: 1 addition & 1 deletion backend/pokerogue/src/main/resources

0 comments on commit 578544e

Please sign in to comment.