Report this

What is the reason for this report?

This site can’t be reached || Connection refused to connect.

Posted on November 6, 2021

we installed lamp on centos 8 with mention below url https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mariadb-php-lamp-stack-on-centos-8-quickstart

Installation done successfully and got “HTTP SERVER TEST PAGE”.

After this we configured CodeIgniter Application on it under “/var/www/html/appName”

Problem is when i call this app through browser its show error “This site can’t be reached”

i have no idea where to go kindly help me out.

Error Log shows "forbidden by Options directive [Sat Nov 06 09:20:11.075134 2021] [autoindex:error] [pid 19705:tid 140037081466624] [client 72.255.58.32:29428] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive @ "



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.

Hey there!

This sounds like a folder permission issue. If you followed that guide the Apache installation should have created the /var/www/html folder already. To remedy this you may need to run sudo chown -R user.user /var/www/html/ where user is the user you are running your Apache webserver as. In the guide it has that set to use sammy as the user and group, but that user won’t exist and is just an example on changing folder permissions. You would need to change those permissions to your system’s username and group.

Hope it helps! Nate

If you’re encountering the “This site can’t be reached” error after setting up a CodeIgniter application on a LAMP stack, there could be several reasons why this is happening. Here are some common troubleshooting steps you can follow:

  1. DNS Propagation: If the domain was recently pointed to the server’s IP, it may not have propagated fully yet. You can check DNS propagation using online tools to see if the domain is resolving to the correct IP address.

  2. Apache Configuration: Ensure that the Apache configuration file for your site is set up correctly. It should have the DocumentRoot directive pointing to /var/www/html/appName. Also, check for the <Directory> directive to ensure it allows Apache to serve files from that directory.

  3. File Permissions: The files within /var/www/html/appName should have the correct permissions. Apache typically runs as the www-data user or apache user on CentOS. Use chown and chmod to set appropriate ownership and permissions.

  4. Firewall Settings: Make sure your server’s firewall isn’t blocking the HTTP (port 80) and HTTPS (port 443) ports. You can adjust the settings with firewall management commands like firewall-cmd.

  5. SELinux Context: CentOS has SELinux enabled by default, which might prevent Apache from reading and executing files in your application directory. You can check and change the SELinux context of your application files with chcon or use setenforce 0 to temporarily put SELinux in permissive mode for testing.

  6. Apache Error Logs: Check the Apache error logs for any specific errors. The error log can be found at /var/log/httpd/error_log on CentOS. Any errors logged here can give you clues about what’s going wrong.

  7. CodeIgniter Configuration: Make sure that the base_url in CodeIgniter’s config file is set correctly. It should match the domain or IP address you’re using to access the site.

  8. Server Restart: After changes to configuration files, always remember to restart Apache to apply the changes using the command sudo systemctl restart httpd.

  9. Test with IP Address: Try accessing the site directly with the server’s IP address to rule out DNS issues. If it works with the IP but not with the domain, it’s likely a DNS issue.

  10. Check for .htaccess Rewrite Rules: If you’re using .htaccess for URL rewrites, ensure that it’s configured properly. Incorrect rewrite rules can cause the site to be inaccessible.

If you’ve checked all the above and the issue persists, you may need to dive deeper into the server configuration, looking at the network configuration, additional security measures in place, or even issues with the CodeIgniter application itself.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.