nginx 도커에서 http2를 활성화하는 중입니다. localhost를 호출 할 때이 오류가 발생합니다. 내 nginx 구성 파일은 아래와 같습니다.
server {
listen 2020 http2;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
Http2 수신 포트는 2020입니다. 컨테이너가 시작될 때 2020에 노출했습니다.
docker run -d --name nginx -p 80:80 -p 2020:2020 -v
/home/pubudu/work/nginx/nginx-tms/config/conf.d:/etc/nginx/conf.d/:ro
nginx:latest
튜토리얼 링크 : Ubuntu 16.04에서 HTTP / 2 지원으로 Nginx를 설정하는 방법
포트 443을 사용해야합니까? 필수인가요? (나는 이것을 위해 SSL을 사용하지 않았습니다)
이 URL을 말리면 아래와 같이 응답합니다.
경고 : 바이너리 출력은 터미널을 망칠 수 있습니다. "--output-"를 사용하여 Warning : curl을 말하여 어쨌든 터미널에 출력하거나 "--output Warning :"을 사용하여 파일에 저장하십시오.
페이지가 http2에서 바이너리로 전송된다는 것을 알고 있습니다. nginx 인덱스 페이지를 응답으로 얻고 싶습니다.
당신의 도움은 정말 감사 할 것입니다.
이에 대한 해결책을 찾았습니다. http2를 달성하려면 nginx에서 SSL을 활성화해야합니다. 나는 그것을 시도하고 잘 작동합니다. 이 링크에서 답을 찾았습니다.
Ubuntu 16.04에서 HTTP / 2 지원으로 Nginx를 설정하는 방법
이제 내 구성 파일은 아래와 같습니다.
server {
listen 443 ssl http2;
server_name localhost;
ssl_certificate /etc/nginx/ssl/nginx-selfsigned.crt;
ssl_certificate_key /etc/nginx/ssl/nginx-selfsigned.key;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다