I have deployed my flask Web in AWS ubuntu ec2 using Nginx, supervisor, and gunicorn. Some strange points: (1) Sometimes I can access my site by the domain name in the safari browser, but after some time, I can not access it by the domain name. The accessed site images by the domain name (test.com)will be the following one:
test.com
parked free, courtesy of GoDaddy.com.
(2) I can access it by IP address using the all browsers.
(3) sometimes I tried another browsers, it can be accessed by the domain. but after I while, the same issue as (1). My setting files as follows:
sudo vim /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
# root /var/www/html;
# Add index.php to the list if you are using PHP
# index index.html index.htm index.nginx-debian.html;
server_name test.com; #
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
proxy_pass http://127.0.0.1:8000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /static { #
alias /home/ubuntu/blog/app/static/;
expires 30d; #
}
}
sudo vim /etc/supervisor/conf.d/blog.conf
[program:flask-blog-owner]
command=/home/ubuntu/blog/bash.sh
directory=/home/ubuntu/blog
user=root
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
bash.sh
#! /bin/bash
cd /home/ubuntu/blog
exec gunicorn -w 4 wsgi:app
DNS information in Godaddy
Records Last updated 29/10/21 4:35 PM
Type Name Value TTL Actions
A @ xx.xx.x.x 1/2 Hour Edit
A @ Parked 600 seconds Edit
CNAME www @ 1 Hour Edit
CNAME _domainconnect _domainconnect.gd.domaincontrol.com 1 Hour Edit
NS @ ns23.domaincontrol.com 1 Hour
NS @ ns24.domaincontrol.com 1 Hour
SOA @ Primary nameserver: ns23.domaincontrol.com. 1 Hour
CodePudding user response:
I have solved it ! Just deleted Parked value DNS setting in the domain name setting of your godaddy account. This may cause the above issue.