https 적용 질문입니다..
556
작성자 없음
작성한 질문수 0
안녕하세요 설치가 다른댓글처럼 404가떠서
다른 댓글에 남기신
https://www.zerocho.com/category/NodeJS/post/5ef450a5701d8a001f84baeb
이거보고 프론트,백 설치했는데요
/etc/nginx/nginx.conf
여기 안에
include /etc/nginx/sites-enabled/*; 이라는 문구가 있으면 nginx.conf말고
vim /etc/nginx/sites-enabled/default 들어가서
그대로 적으면 되는건가요?
서버가 이상한거보니까 제가 뭔가 잘못이해한거같은데
vim /etc/nginx/sites-enabled/default 여기에 그대로 적는게 아닌가요..
첫번째사진이 처음상태고
두번째로 제가 제로초님 블로그 보고 바꾼상태입니다.


sudo service nginx start를 하고
status 는 이상태입니다,,

프론트는 위같은 에러가뜨면서 헤더만뜨고 아무것도안뜨고
백서버는 sudo service nginx start이거하면 아무 말 없이 실행되고
welcome to nginx 인데 백도 지금 잘못된상태인가요?


배포까지는 여태까지 뜨는 에러들 진짜 몇일동안 혼자 다 해결했는데
https적용 이거는 뭐가문제인지를 모르겠어서 질문합니다..
답변 1
1
빨간 에러메시지 읽어보시면 conf 잘못 작성하신게 맞고요. default를 수정하시는 것도 맞슺니다. 다만 default가 제 블로그랑 많이 다른데요? root index server_name 전부 지우세요
0
지워도 똑같긴합니다,,
프론트/백 똑같이 default에는 블로그에있는 이부분들만 있어야하는것 맞나요?
http { server { server_name nodebird.com www.nodebird.com; return 301 https://nodebird.com$request_uri; } server { listen 443 ssl; server_name nodebird.com; ssl_certificate /etc/letsencrypt/live/nodebird.com-0002/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/nodebird.com-0002/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; location / { 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 Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://127.0.0.1:3060; proxy_redirect off; } } }
0
네 저기서 주소만 바꾸시면 됩니다. 위에 올려주신 코드는 최상위 http도 없었습니다. 그리고 #managed by cettbot이 있는 줄은 certbot이 생성해준 것으로, 바꾸시면 안 됩니다.(제 블로그랑 똑같이 하란 말씀이 아닙니다)
0
네 http 씌워도 똑같아요,,
프론트의 default는
```
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
http {
server {
server_name senstory.kr www.senstory.kr;
return 301 https://senstory.kr$request_uri;
}
server {
listen 443 ssl;
server_name senstory.kr;
ssl_certificate /etc/letsencrypt/live/senstory.kr-0002/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/senstory.kr-0002/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
# Add index.php to the list if you are using PHP
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
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 Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:3060;
proxy_redirect off;
}
}
}
```
이렇게 되어있어요.
그리고 백서버에서sudo service nginx start 오류는 안뜨는데
welcome to nginx 뜨는것도 default 문제인가요???
0
senstory.kr-0002가 맞나요? 직접 저렇게 적으신 건 아니죠? 저 줄은 자동으로 생성되어야 합니다.
그리고 nginx.conf도 올려주세요.
백엔드도 설정이 적용이 안 된 겁니다.
0
아 저거는 직접적었는데 sudo ls /etc/letsencrypt/live/ 이거해보니까 폴더경로인가보네요.. -0002 뺐습니다,, 근데 그래도 그대로긴해요
프론트 nginx.conf 입니다.
ubuntu@ip-172-31-11-118:~/senstory/front$ cat /etc/nginx/nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
server {
server_name senstory.kr;
location / {
proxy_set_header HOST $host;
proxy_pass http://127.0.0.1:3060;
proxy_redirect off;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/senstory.kr/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/senstory.kr/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = senstory.kr) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name senstory.kr;
listen 80;
return 404; # managed by Certbot
}}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
0
프론트 default는 이상태입니다.
http {
server {
server_name senstory.kr www.senstory.kr;
return 301 https://senstory.kr$request_uri;
}
server {
listen 443 ssl;
server_name senstory.kr;
ssl_certificate /etc/letsencrypt/live/senstory.kr/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/senstory.kr/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
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 Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:3060;
proxy_redirect off;
}
}
}
0
default에는 http 안 적는 게 맞네요. 제가 블로그에 nginx.conf 까지 전부 올려두었습니다. nginx.conf에도 server 부분이 들어있어서 설정이 중복된 것입니다.
0
이제 문법 오류는 없는것같은데 bind 오류가 뜨고 bad gateway상태가 돼버렸습니다,
영상을 보면 node가 80포트 사용중일때 뜨는 에러같은데
nginx가 잘 사용중이고 sudo npx pm2 kill 하고 다시 sudo service nginx start 해도
bind 에러가 발생하네요.
둘다 nginx가 sudo lsof -i tcp:80해보면 잘 작동하는거같은데
이런경우는 어떤게 문제인가요?? proxy pass 에서 로컬을 https로 쓴것도 아닙니다,,


0
하 이번엔 백에서 자꾸 80포트 노드가 생기는 반복인데 미치겠네요 ㅠㅠㅠ..... 프론트처럼 sudo npx pm2 start 하라는말씀이시죠?? 그렇게해도이러네요,,,

0
늦은시간까지 도와주셔서 감사합니다. 정말 배포+https는 험난한 과정이네요.. 몇일동안 매달렸는지 모르겠네요. 그래도 도와주시고 좋은 강의 해주셔서 정말 정말 감사했습니다!!
0
일단 공식문서 기반으로 설정을 살펴본 것이고요. 한 줄 한 줄 모두 의미가 있으므로 찾아보시는 것을 추천드립니다. 그리고 오랜 경험으로 이미 저는 제대로 돌아가는 설정 코드를 갖고 있습니다.
넥스트 버젼 질문
0
78
2
로그인시 401 Unauthorized 오류가 뜹니다
0
89
1
무한 스크롤 중 스크롤 튐 현상
0
175
1
특정 페이지 접근을 막고 싶을 때
0
103
2
createGlobalStyle의 위치와 영향범위
0
96
2
인라인 스타일 리렌더링 관련
0
91
2
vsc 에서 npm init 설치시 오류
0
147
2
nextjs 15버전 사용 가능할까요?
0
158
1
화면 새로고침 문의
0
121
1
RTK에서 draft, state 차이가 있나요?
0
153
2
Next 14 사용해도 될까요?
0
452
1
next, node 버전 / 폴더 구조 질문 드립니다.
0
349
1
url 오류 질문있습니다
0
211
1
ssh xxxxx로 우분투에 들어가려니까 port 22: Connection timed out
0
373
1
sudo certbot --nginx 에러
0
1275
2
Minified React error 콘솔에러 (hydrate)
0
470
1
카카오 공유했을 때 이전에 작성했던 글이 나오는 버그
0
247
1
프론트서버 배포 후 EADDRINUSE에러 발생
0
327
1
npm run build 에러
0
518
1
front 서버 npm run build 중에 발생한 에러들
0
382
1
서버 실행하고 브라우저로 들어갔을때 404에러
0
338
2
css 서버사이드 랜더링이 적용되지 않아서 문의 드립니다.
0
288
1
팔로워 3명씩 불러오고 데이터 합쳐주는걸로 바꾸고 서버요청을 무한으로하고있습니다.
0
239
2
해시태그 검색에서 throttle에 관해 질문있습니다.
0
201
1





