Nginx에 문제가 있어 도움이 필요합니다.
2개의 A DNS 레코드를 만들었습니다.
www.domain_name.docker.hub.registry.domain_nameetc.com그리고도메인 이름.docker.hub.registry.domain_nameetc.com
/var/www/domain_name.docker.hub.registry/html 폴더 아래에 있는 index.html 페이지를 반환하려면 둘 다 필요합니다.
지금까지 내가 탐색했을 때www.domain_name.docker.hub.registry.domain_nameetc.com, index.html 페이지가 나타납니다.
내가 탐색할 때도메인 이름.docker.hub.registry.domain_nameetc.com, "nginx에 오신 것을 환영합니다" 페이지가 나타납니다.
어떻게 구성해도메인 이름.docker.hub.registry.domain_nameetc.com표준 "nginx에 오신 것을 환영합니다" 페이지 대신 index.html 페이지를 반환하시겠습니까?
아래에 제공된 것은 내 서버 블록 코드입니다. 미리 감사드립니다! !
server {
root /var/www/domain_name.docker.hub.registry/html;
index index.html;
listen 80;
listen 443 ssl;
server_name domain_name.docker.hub.registry domain_name.docker.hub.registry.domain_nameetc.com;
location / {
try_files $uri $uri/ =404;
}
#listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/domain_name.docker.hub.registry.domain_nameetc.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain_name.docker.hub.registry.domain_nameetc.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
return 301 https://www.domain_name.docker.hub.registry.domain_nameetc.com$request_uri;
}
server {
root /var/www/domain_name.docker.hub.registry/html;
index index.html index.htm;
# listen to the standard http port 80
#listen 80;
listen 443 ssl;
server_name domain_name.docker.hub.registry www.domain_name.docker.hub.registry.domain_nameetc.com;
location / {
try_files $uri $uri/ =404;
}
ssl_certificate /etc/letsencrypt/live/www.domain_name.docker.hub.registry.domain_nameetc.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.domain_name.docker.hub.registry.domain_nameetc.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
}
답변1
나는 그것에 대해 생각했다. 아래에 제가 채택한 솔루션이 나와 있습니다. 최종 솔루션에 대한 피드백을 제공해 주세요.
server {
root /var/www/<domain>.docker.hub.registry.<domain>.com/html;
index index.html;
server_name <domain>.docker.hub.registry.<domain>.com;
listen 80;
listen [::]:80;
location / {
try_files $uri $uri/ =404;
}
}
server {
root /var/www/<domain>.docker.hub.registry.<domain>.com/html;
index index.html;
server_name www.<domain>.docker.hub.registry.<domain>com;
listen 80;
listen [::]:80;
location / {
try_files $uri $uri/ =404;
}
}
server {
root /var/www/<domain>.docker.hub.registry.<domain>.com/html;
index index.html;
server_name <domain>.docker.hub.registry.<domain>.com;
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate /etc/letsencrypt/live/<domain>.docker.hub.registry.<domain>.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/<domain>.docker.hub.registry.<domain>.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
location / {
try_files $uri $uri/ =404;
}
}
server {
root /var/www/<domain>.docker.hub.registry.<domain>.com/html;
index index.html;
server_name www.<domain>.docker.hub.registry.<domain>.com;
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate /etc/letsencrypt/live/<domain>.docker.hub.registry.<domain>.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/<domain>.docker.hub.registry.<domain>.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
location / {
try_files $uri $uri/ =404;
}
}