Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

SergioGregorutti's avatar

Error 521 - Web server is down (Forge/Cloudflare/DigitalOcean)

Hi all,

I'm trying to host my project without success. www.programandoconsergio.com

When I load the site I get an "Error 521 - Web server is down" message from Cloudflare or "This site can’t be reached / ERR_CONNECTION_CLOSED" sometimes.

I created a server using Laravel Forge, then I have Cloudflare managing the DNS (Domain from GoDaddy), and the droplet running on Digital Ocean.

I created an SSL certificate on Cloudflare, it's installed on Laravel Forge (main domain and a subdomain). The DNS options seem to be ok.

I don't know how can I solve this problem.

Any ideas?

Thanks in advance!

0 likes
10 replies
SergioGregorutti's avatar
Level 3

After research, it was a server configuration issue and it's fixed and working as expected. Thanks.

commit's avatar

Hi Sergio,

I've exactly the same problem, how did you solved it?

SergioGregorutti's avatar

Hi,

It was a problem with the server configuration. NGINX in my case. Take a look and confirm that all the site configuration is in the right place.

Regards.

forefront's avatar

What was wrong with your nginx config mine seems fine when doing configtest?

ashokrajc's avatar

In Cloudflare SSL/TLS Tab

change encryption mode from Full to Flexible.

2 likes
carlosromanxyz's avatar

@ashokrajc Be careful, check this:

Setting your encryption mode to Flexible makes your site partially secure. Cloudflare allows HTTPS connections between your visitor and Cloudflare, but all connections between Cloudflare and your origin are made through HTTP. As a result, an SSL certificate is not required on your origin.

ndr3svt's avatar

In my case:

sudo nginx -t -c /etc/nginx/nginx.conf

pointed at the error, which was one or more SSL related files having a wrong path or were unreachable at the nginx configuration file. You can reach this file directly to FORGE, under your site and click on "Edit Files" and then select "Edit Nginx Configuration"

In my case at this file I modified the corresponding certificate and certificate keys

ssl_certificate /path/blabla/idNumber/server.crt;

ssl_certificate_key /path/blabla/idNumber/server.key;

be sure that you have ssl certificates already installed on your site. If you don't know how to generate these google "cloudflare ssl nginx" or "cloudflare ssl forge"

Please or to participate in this conversation.