Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NginX 정적 파일 로드 #8

Open
Dae-Hwa opened this issue Apr 21, 2021 · 2 comments
Open

NginX 정적 파일 로드 #8

Dae-Hwa opened this issue Apr 21, 2021 · 2 comments
Assignees
Labels
BE help wanted Extra attention is needed

Comments

@Dae-Hwa
Copy link
Owner

Dae-Hwa commented Apr 21, 2021

현재 설정

server_name localhost;

location / {
        root /var/www/html;
        index index.html index.htm index.nginx-debian.html;

        proxy_pass http://localhost:8081;
        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;
}

location ~ \.(css|js|jpg|jpeg|gif|htm|html|swf)$ {
        root /var/www/html;
                index index.html index.htm index.nginx-debian.html;
        }

location /index.html {
        root /var/www/html/index.html
}

예상 결과?

  • 정적파일은 엔진엑스에 들어있는게 맞다.
  • index.html도 엔진엑스에서 가져올 수 있어야 한다.

실행 결과

  • 톰캣에서 hello 페이지를 찾지 못함(톰캣의 404에러)
  • /index.html 은 찾아옴

의문점

  • 톰캣에서 index.html을 왜 못 찾나?

    • classpath 설정이 되어있지 않아서?
    • 80포트를 입력하지 않아서?
  • hello 페이지는 왜 덮어씌워지지 않는지

  • 루트에서 접속하는 방식을 nginx로 직접 하는게 아니라, 캐싱 된 데이터를 사용하도록 해야하는건지?

    참고

    • 캐싱이 되더라도 index.html에 한 번은 다녀와야 하는게 아닌지?(톰캣입장에서)
@Dae-Hwa Dae-Hwa added help wanted Extra attention is needed BE labels Apr 21, 2021
@Dae-Hwa Dae-Hwa added this to the [BE]서버구성 milestone Apr 21, 2021
@Dae-Hwa Dae-Hwa added this to To do in BE-준비단계 via automation Apr 21, 2021
@Dae-Hwa
Copy link
Owner Author

Dae-Hwa commented Apr 21, 2021

현재 동작 중
설정

# Default server configuration
#
server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;

        server_name localhost;

        location / {
                try_files $uri $uri/ @apachesite;
        }

        location ~ \.(css|js|jpg|jpeg|gif|htm|html|swf)$ {
        }

        location @apachesite {
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass http://127.0.0.1:8081;
        }
        
        # try_files 테스트용
        location /index2 {
                try_files $uri /index.html;
        }
}

참고

@Dae-Hwa
Copy link
Owner Author

Dae-Hwa commented Apr 23, 2021

  • cors 문제 없는지 확인 필요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE help wanted Extra attention is needed
Projects
Development

No branches or pull requests

2 participants