www 하위 도메인은 작동하지만 다른 도메인은 작동하지 않습니다.

www 하위 도메인은 작동하지만 다른 도메인은 작동하지 않습니다.

nginx에서 이해할 수 없는 문제가 발생했습니다.

올바르게 설정하고 호출할 수 있습니다 www.example.tech.example.tech

survey.example.tld그러나 목록에 다른 하위 도메인을 추가하면 나머지 두 도메인은 여전히 ​​작동하지만 survey.example.tld작동하지 않습니다.

크롬에서 전화를 걸 때 다음과 같은 오류 메시지가 나타납니다 http://survey.example.tech/.

이 사이트에 접속할 수 없습니다. Survey.example.tech에 오타가 있는지 확인하세요. DNS_PROBE_FINISHED_NXDOMAIN

세 번 확인했기 때문에 오타가 없다고 확신합니다. 또한 www.example.tech여전히 example.tech작동합니다.

나는 nginx를 사용하여 요청을 gunicorn/flask 앱으로 전달합니다.

그러므로 나는 내 구성을/etc/nginx/sites-enabled

$ cat /etc/nginx/sites-enabled/survey.example.tech 

server {    
    server_name example.tech www.example.tech survey.example.tech;
    
    location /static {
        alias /opt/example.tech/my-domain-Survey-Website/static;
    }
    
    location / {
        proxy_pass http://localhost:8003;
        include /etc/nginx/proxy_params;
        proxy_redirect off;
        # Max file size allowed for upload by user. Here 1M = 1 Megabyte
        client_max_body_size 1M;
        
        # prevents warning messages when setting up let's encrypt
        proxy_headers_hash_max_size 512;
        proxy_headers_hash_bucket_size 128;
        
        # Enable Websocket by adding these two options
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
    }
}

그리고 그에 상응하는 서비스/etc/systemd/system

$ cat /etc/systemd/system/gunicorn-my-domain-survey-flask.service 
[Unit]
Description = gunicorn for my-domain website
After = network.target

[Service]
Environment=LOG_PATH=/opt/example.tech/example.tech-Survey-Website/gunicorn-logs
User = ubuntu
Group = ubuntu
WorkingDirectory = /opt/example.tech/example.tech-Survey-Website
ExecStart = /opt/example.tech/venv/bin/gunicorn --bind 127.0.0.1:8003 -w 1 --log-level debug --access-logfile ${LOG_PATH}/access-logfile.log --error-logfile ${LOG_PATH}/error.log  --capture-output run_survey_website:app

[Install]
WantedBy = multi-user.target

이것을 실행하면 survey.example.tech.

여기서 무슨 일이 일어나고 있나요? nginx를 사용한 하위 도메인 설정을 잘못 이해하고 있습니까?

답변1

nginx 구성은 괜찮습니다.

survey.example.tech서버의 IP 주소를 가리키는 DNS 레코드를 추가해야 합니다 .

관련 정보