Place the return
statement inside a location
block:
For example:
server {
listen 8080;
server_name my_example.com;
location /.well-known/acme-challenge/ {
root /var/www/encrypt;
}
location / {
return 301 https://$server_name$request_uri;
}
}
Also, simplified your other location
block.