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!
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:
sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/
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:
<VirtualHost *:80>
ServerAdmin admin@yourdomain.com
DocumentRoot /var/www/html
ServerName yourdomain.com
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
After making changes, don’t forget to restart Apache:
sudo systemctl restart apache2
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:
sudo a2enmod rewrite
sudo systemctl restart apache2
Check your firewall settings to ensure that traffic on port 80 (HTTP) is allowed:
sudo ufw allow 'Apache Full'
sudo ufw reload
Finally, if you’re still having trouble, check the Apache error logs for more details:
sudo tail -f /var/log/apache2/error.log
The logs can give you specific hints about what might be going wrong.
Good luck, and happy deploying!
- Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.