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;
}
}