nginx 설정

nginx 설정

QA

nginx 설정

본문

보드 설치하여 잘되던데

이제 ssl적용하니까 주소창에는 자물쇠 잘 나오는데 페이지는 

nginx error!

떡하니 뜨네요,

 

config.php에는 도메인넣었구요

 

 

설정파일은 이런데 왜 페이지 애러날까요?

 

# 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  /var/log/nginx/access.log  main;

    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;

    server {
        listen       80;
        listen       [::]:80;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;


        error_page 404 /404.html;
        location = /404.html {
        }

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        }
    }

# Settings for a TLS enabled server.
#
#    server {
#        listen       443 ssl http2;
#        listen       [::]:443 ssl http2;
#        server_name  _;
#        root         /usr/share/nginx/html;
#
#        ssl_certificate "/etc/pki/nginx/server.crt";
#        ssl_certificate_key "/etc/pki/nginx/private/server.key";
#        ssl_session_cache shared:SSL:1m;
#        ssl_session_timeout  10m;
#        ssl_ciphers PROFILE=SYSTEM;
#        ssl_prefer_server_ciphers on;
#
#        # Load configuration files for the default server block.
#        include /etc/nginx/default.d/*.conf;
#
#        error_page 404 /404.html;
#            location = /40x.html {
#        }
#
#        error_page 500 502 503 504 /50x.html;
#            location = /50x.html {
#        }
#    }

    server {
    server_name mydomain.com; # managed by Certbot
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
                proxy_pass http://localhost:8080;
        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;
        }


        error_page 404 /404.html;
        location = /404.html {
        }

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        }
    

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/mydomain.com/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 = mydomain.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen       80 ;
        listen       [::]:80 ;
    server_name mydomain.com;
    return 404; # managed by Certbot


}}

 

이 질문에 댓글 쓰기 :

답변 4

어떤 오류가 있는지

/var/log/nginx/error.log 로그파일 채크해보세요.

이런데 어떻게 할지 모르겠네요
2022/03/21 08:01:07 [error] 29635#29635: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 45.222.17.205, server: domain.com, request: "GET /api/v1/notices?page=1&per_page=1&thread_name=general HTTP/1.1", upstream: "http://51.44.181.11:8080/api/v1/notices?page=1&per_page=1&thread_name=general", host: "api-manager.upbit.com"

응답시간 초과 에러 같은데요?

nginx 설정 파일에서 proxy_connect_timeout 값이 얼마로 되어있나요?

검색해보고 관련있는지 모르겟지만 그렇게 말하는거 같아서

                proxy_buffer_size          128k;
                proxy_buffers              4 256k;
                proxy_busy_buffers_size    256k;

이렇게 넣어놨씁니다. 그래도 애러가,,,생기네요

https://matamong.tistory.com/entry/Nginx-Nginx-while-connecting-to-upstream-%EC%97%90%EB%9F%AC

위 링크 한번 채크해보시겠어요?

감사합니다. 그것도 이미 보고 별짓다해봤네요,ㅜㅜ
2일동안 삽질끝에 해결했습니다.
인터넷에서 보고
        location / {
                proxy_pass http://localhost:8080;
        proxy_set_header X-Real-IP $remote_addr

이런식으로 넣으라해서 그건 당연히 하는걸줄 알고 안되니까 별짓다했습니다.
삭제해버리니까
위에 있는 80포트를
아래 ssl 443포트로 리다이렉트 바로 되는건데...

ㅎㅎ 잘 해결되셨다니 다행입니다^^

ㅎㅎ 감사합니다. aws에서 ssl무료라더니 정작 발급만 무료고 그걸 적용해서 쓰려면
매달 2만원씩 내야 한데요,,지랄,,,요즘 5년짜리 발급받아도 3만원이면 되는데...

답변을 작성하시기 전에 로그인 해주세요.
전체 0 | RSS
QA 내용 검색
  • 개별 목록 구성 제목 답변작성자조회작성일
  • 질문이 없습니다.

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT