Hi everyone,
I’m trying to deploy a website on DigitalOcean but I’m encountering some issues. Specifically, I’m having trouble with the setup of my droplet and the configuration of my DNS settings.
Here are the steps I’ve taken so far:
Despite this, I keep getting a “403 Forbidden” error when trying to access the site. I’ve verified that the files are in the correct directory and have set the correct permissions.
Has anyone encountered a similar issue or does anyone have advice on how to resolve this? Any help would be greatly appreciated!
Thanks in advance!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Hey 👋
It sounds like you’ve already done quite a bit of the setup, which is awesome!
A “403 Forbidden” error usually points to a permissions issue or a configuration setting in Apache. Let’s go through a few things to troubleshoot and get your site up and running:
Make sure that the files in your web directory (
/var/www/html/
by default) are accessible by the Apache user (www-data
). You can adjust the permissions with the following commands:This ensures that Apache can read and execute the files.
Check your Apache configuration file to make sure everything is set up correctly. You’ll want to ensure that the
DocumentRoot
is pointing to the correct directory and that you’ve allowed access:After making changes, don’t forget to restart Apache:
If you’ve just updated your DNS settings, remember that DNS changes can take some time to propagate. You can check if the DNS records are correctly pointing to your droplet’s IP using a tool like whatsmydns.net.
If you’re using an
.htaccess
file, make sure it doesn’t have any rules that could be causing the 403 error. Sometimes, misconfigured.htaccess
files can restrict access unintentionally.Ensure that the necessary Apache modules are enabled, especially
mod_rewrite
if you’re using it for URL rewriting. You can enable it with:Check your firewall settings to ensure that traffic on port 80 (HTTP) is allowed:
Finally, if you’re still having trouble, check the Apache error logs for more details:
The logs can give you specific hints about what might be going wrong.
Good luck, and happy deploying!
- Bobby