내 웹사이트에 액세스하려고 할 때 다음 오류가 발생합니다 Chrome Version 66.0.3359.139 (Official Build) (64-bit)
.
시도해 보니 Firefox 60.0(64 bit)
효과가 있었습니다!
내가 사용하는 nginx 버전
nginx -V
nginx version: nginx/1.13.12
built by gcc 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)
built with OpenSSL 1.1.0f 25 May 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-1.13.12/debian/debuild-base/nginx-1.13.12=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'
컬이 나에게 준200 OK
curl -I https://v4tailor.com
HTTP/2 200
date: Sat, 12 May 2018 14:49:46 GMT
content-type: text/html; charset=UTF-8
set-cookie: __cfduid=d54d82d396e2f2bad73930fda4a6b883a1526136586; expires=Sun, 12-May-19 14:49:46 GMT; path=/; domain=.v4tailor.com; HttpOnly
cache-control: no-cache, private
strict-transport-security: max-age=31536000;
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
server: cloudflare
cf-ray: 419db19f1d899a04-EWR
Nginx 구성. LetsEncrypt를 사용합니다.
//nginx.conf
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
root /var/www/html;
index index.php;
server_name v4tailor.com www.v4tailor.com;
# SSL Certificates
ssl_certificate "/etc/letsencrypt/live/v4tailor.com/cert.pem";
ssl_certificate_key "/etc/letsencrypt/live/v4tailor.com/privkey.pem";
ssl_dhparam /etc/nginx/dhparam.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_session_cache shared:SSL:1m;
ssl_session_tickets off;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security "max-age=31536000;
#includeSubDomains" always;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
}
LetsEncrypt로 전환했을 때 모든 것이 시작되었습니다. 처음에는 내가 사용하는 모든 브라우저가 Gecko 엔진에 구현되어 있었기 때문에 깨닫지 못했지만 상사에게 데모를 보여주고 싶었을 때 당황스럽게 작동하지 않았습니다. -.-.
처음에는 SSL용으로 Cloud-flare만 사용했습니다.
캐시를 지우고 chrome://net-internals/events에서 확인해 보았습니다. 또한 다른 컴퓨터에서도 테스트되었습니다.
Google에서 이 오류를 검색하는 것은 모호하기 때문에 매우 어렵습니다.
고정시키다
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
root /var/www/html/main/public;
index index.php;
server_name v4tailor.com www.v4tailor.com;
# SSL Certificates
ssl_certificate "/etc/letsencrypt/live/v4tailor.com/cert.pem";
ssl_certificate_key "/etc/letsencrypt/live/v4tailor.com/privkey.pem";
ssl_dhparam /etc/nginx/dhparam.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_session_cache shared:SSL:1m;
ssl_session_tickets off;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security: max-age=31536000;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location /render {
proxy_pass http://127.0.0.1:5000/render;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~ ^/index\.php(/|$) {
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
# optionally set the value of the environment variables used in the application
fastcgi_param APP_ENV prod;
fastcgi_param APP_SECRET 23kl86a56;
fastcgi_param DATABASE_URL "mysql://root:patriot356@@localhost:3306/v4tailor";
# When you are using symlinks to link the document root to the
# current version of your application, you should pass the real
# application path instead of the path to the symlink to PHP
# FPM.
# Otherwise, PHP's OPcache may not properly detect changes to
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
# for more information).
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
# Prevents URIs that include the front controller. This will 404:
# http://domain.tld/index.php/some-path
# Remove the internal directive to allow URIs like this
internal;
}
location /blog {
try_files $uri $uri/ /blog/index.php?$args;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
}
Firefox는 헤더 오류를 무시하지만 Chrome이 정지됩니다. 감사합니다! ! Nginx 구성 테스트를 정확히 어떻게 통과했는지 알고 싶습니다. 이것은 정말 두통입니다.
답변1
이것이 문제의 원인인지는 확실하지 않지만 구성의 다음 부분이 확실히 잘못되었습니다.
add_header Strict-Transport-Security "max-age=31536000;
#includeSubDomains" always;
그러면 다음과 같은 HTTP 응답 헤더가 생성됩니다.
Strict-Transport-Security: max-age=31536000;
#includeSubDomains:
구성에서 참조를 닫는 것을 잊어서 헤더가 손상된 것 같습니다. 일부 브라우저는 이 깨진 헤더를 무시하지만 일부 브라우저는 그렇지 않습니다.