Cloud hosting providers like Linode make web application building easier.
To begin with, we need to set up a web server. Although, there are many web servers available, Apache is a common choice.
At times, the Apache setup process in Linode can show up errors due to bad configuration.
Here at Bobcares, we fix Linode Apache server issues as part of our Managed Cloud Services.
Today, we’ll see the steps to easily install Apache on Linode and how our Cloud Engineers solve typical errors with it.
How to set up Apache in Linode?
Firstly, let’s see how to setup Apache in Linode server. The setup process basically involves 3 steps.
- Installing the Apache packages
- Configuring virtual host
- Modifying the server firewall to allow web server traffic.
Again, the steps slightly differ based on the type of Linode server.
For example, in CentOS7 servers, our Dedicated Engineers install Apache using the following command:
yum install httpd
Similarly, if the Linode server is based on Ubuntu, we use
apt-get install apache2 apache2-doc apache2-utils
As the next step, we modify the Apache configuration file to include the details of each domain. Then comes the virtual host configuration. Here, we configure the website directory path, log file location, IP address details and so on.
After completing the configuration, we proceed with Apache restart. This makes Apache running on the Linode server.
Lastly, we make modifications in the server firewall to allow web traffic on the server. This involves adding UFW firewall rules in Ubuntu server, or modifying Firewalld service in CentOS7.
Top errors in Linode Apache setup
Although the setup of Apache is pretty straight forward, we often see Linode owners reporting problems with Apache. Let’s have a close look at them.
1. Syntax errors in Apache config
Recently, a Linode customer reported trouble viewing his website on Linode server. The error said:
The requested URL / was not found on this server.
Apache/2.4.29 (Ubuntu) Server at abc.domain.com Port 80
Here, our Support Engineers started the troubleshooting by examining the Apache log files. And, we could see syntax errors in the configuration. For this, we used the command:
apachectl -t
It showed that there was a typo error in the website directory path in the Apache configuration. We corrected it, restarted Apache and website started loading.
2. Website not accessible at server IP address
Similarly, Linode customers may not be able to access their websites using IP address. Here, accessing the website from browsers like Firefox using http://<serverIP> would report the error:
The connection has timed out.
The server at 187.xx.xx.21 is taking too long to respond.
On further checking, we could see that the web traffic was being dropped at the server firewall. So, our Support Engineers had to modify the Ubuntu firewall to allow http traffic using
ufw allow http
After this, website was accessible fine on the server IP address.
3. Permission problems in Apache
Again, Apache errors can show up due to permission problems too. One such example is :
(13)Permission denied: AH00091: httpd: could not open error log file /var/www/html/example.com/logs/error.log.
AH00015: Unable to open logs.
This error happens as the Apache user could not open the log file due to lack of permissions. To fix, we set proper permissions on the log folder.
Additionally, we’ve seen that kernel security modules like SELinux often create problems with Apache too. Here, our Dedicated Engineers set proper SELinux permissions on the files and folders.
[Having trouble with Apache in Linode server? Our Linode Engineers can fix it for you.]
Conclusion
In a nut shell, Apache set up in Linode server is pretty easy. But, often Linode owners run into problems due to wrong configuration. Today, we saw how our Cloud Engineers set up Linode Apache server and fix common errors in it.
0 Comments