안녕하세요~

 

몇일전 사이트에 짧은주소 를 적용 하고 오늘 ssl (Let’s Encrypt) 적용 하고 마지막 단계 설정을 잘못했는지

 

접속시 403/404 에러가 나오네요

 

우분투18.04 / php 7.4 / nginx 사용 중 입니다.

 

마지막 설정을

 

vi /etc/nginx/conf.d/papazones.com



server {
listen       443 ssl http2;
server_name  ssl-demo-1604.lael.be;
root   /home/ssl-demo-1604/www;
client_max_body_size 10M;
 
ssl_certificate "/etc/letsencrypt/live/mysitename.com/fullchain.pem";
ssl_certificate_key "/etc/letsencrypt/live/mysitename.com/privkey.pem";
ssl_dhparam "/etc/ssl/certs/dhparam.pem";
 
# Enable HSTS. This forces SSL on clients that respect it, most modern browsers. The includeSubDomains flag is optional.
add_header Strict-Transport-Security "max-age=31536000";
}

 

이것만 추가를 해주었습니다. 당연히 내용의(사이트주소) 수정은 하였구요.

 

이것이 최근 짧은주소 변경 한 것과 관련있어서 그런건지 잘 모르겠습니다.

마땅히 질문할 곳을 잘 모르겠어서 질문게시판에 올립니다.

 

답변 가능하신 분께서는 꼭 부탁 좀 드리겠습니다.

 

  • profile
    root 디렉토리 설정을 그대로 복붙하신거 아닐까요?
  • profile profile

    웹지기님 "root 디렉토리 설정을 그대로 복붙" 에 대해서 이해를 잘 못하겠습니다.

     

    웹지기님 이해 했습니다 죄송합니다 ㅎㅎㅎ 디렉토리 설정 다 변경했습니다

  • profile

    SSL 적용하기 전에 쓰시던 설정을 빠짐없이 복붙하셔야 예전과 동일하게 작동합니다.

    지금은 index 설정도 안 보이고 PHP 연동하는 설정도 안 보이네요.

  • profile profile
    vi /etc/nginx/conf.d/papazones.com.conf
    server {
        listen       80;
        server_name  papazones.com www.papazones.com;
        root   /home/papazones/www;
        server_tokens off;
    
        add_header X-Frame-Options SAMEORIGIN;
        add_header X-Content-Type-Options nosniff;
        add_header X-XSS-Protection "1; mode=block";
    
        charset utf-8;
    
        #set same size as post_max_size(php.ini or php_admin_value).
        client_max_body_size 32M;
    
        access_log /var/log/nginx/papazones.com.access.log main;
        error_log  /var/log/nginx/papazones.com.error.log error;
        include /etc/nginx/rhymix-nginx.conf;
    
        location / {
            index  index.php index.html;
        }
     
        # Allow Lets Encrypt Domain Validation Program
        location ^~ /.well-known/acme-challenge/ {
            allow all;
        }
    
        # Block dot file (.htaccess .htpasswd .svn .git .env and so on.)
        location ~ /\. {
            deny all;
        }
    
        # Block (log file, binary, certificate, shell script, sql dump file) access.
        location ~* \.(log|binary|pem|enc|crt|conf|cnf|sql|sh|key|yml|lock)$ {
            deny all;
        }
    
        # Block access
        location ~* (composer\.json|composer\.lock|composer\.phar|contributing\.md|license\.txt|readme\.rst|readme\.md|readme\.txt|copyright|artisan|gulpfile\.js|package\.json|phpunit\.xml|access_log|error_log|gruntfile\.js)$ {
            deny all;
        }
    
        location = /favicon.ico {
            log_not_found off;
            access_log off;
        }
    
        location = /robots.txt {
            log_not_found off;
            access_log off;
        }
    
        # Block .php file inside upload folder. uploads(wp), files(drupal), data(gnuboard).
        location ~* /(?:uploads|default/files|data)/.*\.php$ {
            deny all;
        }
    
        # Add PHP handler
        location ~ [^/]\.php(/|$) {
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            if (!-f $document_root$fastcgi_script_name) {
                return 404;
            }
    
            fastcgi_read_timeout 300;
            fastcgi_pass unix:/run/php/papazones.sock;
            fastcgi_index index.php;
            fastcgi_buffers 64 16k; # default 8 4k
    
            include fastcgi_params;
        }
    }
    
    server {
    listen       443 ssl http2;
    server_name  papazones.com;
    root   /home/papazones/www;
    client_max_body_size 10M;
     
    ssl_certificate "/etc/letsencrypt/live/papazones.com/fullchain.pem";
    ssl_certificate_key "/etc/letsencrypt/live/papazones.com/privkey.pem";
    ssl_dhparam "/etc/ssl/certs/dhparam.pem";
     
    # Enable HSTS. This forces SSL on clients that respect it, most modern browsers. The includeSubDomains flag is optional.
    add_header Strict-Transport-Security "max-age=31536000";
    }

    이 상태에서 하단에 추가를 하였습니다

    어디서 잘못된건지 잘 모르겠습니다 현재 추가한 내용을 상단 server { 안에 추가를 해야 하는건지 아니면 어디서 해야 하는건지 이것도 틀리다면 .. 저는 정말 노답인거 같아요..ㅠㅠ

    https://blog.lael.be/post/5107 이걸 보고 진행을 하였습니다

  • profile profile
    기진곰님 답변달아주셔서 감사합니다 ssl 적용은 하긴 했는데 뭐가 문제인지 메뉴구성한것들 누르면 홈으로만 돌아가는데 그건 뭐가문젠지 모르지만 찾아보면서 해결해보도록 하겠습니다~ 혹 정말 못찾겠으면 다시 질문 할께요~
  • profile profile

    기존 설정이 완벽하게 복붙되지 않은 것이겠지요.

    아예 복붙할 필요 없도록 하나로 합치세요. 사이트 하나에 server 설정이 2개 존재할 이유가 없습니다.

    (SSL 적용시 설정을 중복으로 해야 하는 것은 아파치 방식입니다. ㅎㅎ)

     

    server {
        listen 80;

        listen 443 ssl http2;

     

        # 기존 설정 모두 여기에 넣기 (PHP 연동 설정, 각종 보안설정 등)

        # 짧은주소 관련 설정은 보이지 않습니다. 찾아서 넣으세요.

     

        ssl_certificate "/etc/letsencrypt/live/papazones.com/fullchain.pem";
        ssl_certificate_key "/etc/letsencrypt/live/papazones.com/privkey.pem";
        ssl_dhparam "/etc/ssl/certs/dhparam.pem";
     
        # Enable HSTS. This forces SSL on clients that respect it, most modern browsers.
        add_header Strict-Transport-Security "max-age=31536000";

    }

  • profile profile
    짧은주소 설정 방법은 아래 링크를 참고하세요.
    https://github.com/rhymix/rhymix-docs/blob/master/ko/introduction/nginx.md
  • profile profile
    우선 어제 밤부터 지금까지 병원에 있다가 와서 ㅎㅎ 퇴근 후 잠좀 잔 후에 적용을 해보도록 할께요 답변 매우 감사합니다 성공하면 답글남기겠습니다~
  • profile
    https://webmaster.cafe/tools/nginx-conf-generator/my-example-site.com.php 여기서 conf 파일 새로 생성하고 사이트 시스템 설정에서 ssl 로 변경 하고 완료 했습니다. 괜히 삽질하고 있었네요 지금은 https 로 접속이 잘 되는 것 같습니다~ 답변 모두 감사합니다
  • profile
    근데 다시 보니까 -ㅅ- 메뉴 를 선택해도 화면으로 넘어가질 안아요~ㅋㅋㅋ
  • profile profile
    긴주소로 접속되는거 보니 이번에 추가작업하면서 기존 짧은주소 설정이 안먹히나보네요.
  • profile profile
    확인하고 다시 새로 해볼께요 답변 정말 감사합니다!