Troubleshooting Linux web Server |
Introduction
In this article, we will share with you some troubleshooting Linux web Server steps which are some common steps that administrators take when they can’t access the site properly. You can review these steps and solve the problem in order to activate your site and run.
Check the server status
Before proceeding with the above steps, we must first check whether you can access the server.
Sometimes the server itself may malfunction. You can verify this using ping and ssh commands
ping your_server_ip
Monitoring your server
The server may not respond due to high processor load and memory consumption.You can refer to this document for how to monitor the E2E server through Zabbix
Check the Logs
Before tracking the problem, you should check the logs of the web server and related components. If you find errors or suspicious logs in your access logs, you can pinpoint the problem. The logs are typically located in the / var/log directory. If you have an Apache server running on an Ubuntu server, by default logs are stored in / var / log / apache2.
Check the files in this directory for what kind of error message is generated. Basically, if you're using a distribution that references Apache to httpd, your logs will be stored in the following location:
list of the log files are followings
/var/log/messages
/var/log/dmesg
/var/log/auth.log
/var/log/boot.log
/var/log/daemon.log
/var/log/kern.log
/var/log/lastlog
/var/log/maillog /var/log/mail.log
/var/log/user.log -
/var/log/Xorg.x.log
/var/log/btmp
/var/log/cups /var/log/spooler
/var/log/anaconda.log
/var/log/yum.log
/var/log/cron -
/var/log/secure
/var/log/wtmp
/var/log/utmp -
/var/log/faillog
/var/log/httpd/
/var/log/apache2
/var/log/conman/
/var/log/mail/
/var/log/audit/ -
/var/log/setroubleshoot/ -
/var/log/samba/
/var/log/sa/
Make sure your web server is running
You can check whether the service is working properly or not. One way to check whether a service is running or not is the distro's recommended method.
Check out the following share command: If the service is not running, you can start it with the following start command:
Apache as Apache2, the command to use the apache2 features
service apache2 start
service apache2 stop
service apache2 restart
service apache2 reload
service apache2 status
Verifying the Syntax of Webserver
if the webserver does not start, it means that there is a problem with the configuration file. To read both Apache and Nginx files, you need proper directive syntax. The configuration file is as follows:
The basic configuration directory for Apache is: Debian and Ubuntu distributions : /etc/apache2/
Fedora, CentOS distributions : /etc/httpd/
When I run the above command, I get a Syntax OK or Test is the successful message. This means that there are no errors in the webserver configuration.
Invalid arguments are provided when a message such as "test failed" is displayed.
It is in the configuration file and needs to be edited.
Database back-end running Fine
If you are configuring your site to connect to a database backend such as MySQL, PostgreSQL, MongoDB, etc, you need to make sure the site is running. This can be done when you check the webserver.
Verify that the database is running MySQL/Mongod by running the following command:
service MySQL status
service mysqld status
service mongod status
netstat -ntlp | grep mysql
Make sure the Ports are open
Even if all configurations and connections are correct, you may not be able to access the site because the configured ports are accessible. The web server uses port 443 for SSL-encrypted traffic, which runs on port 80 for normal web traffic.
You can check whether the configured port is open with the telnet command
telnet your_server_ip 80
telnet your_server_ip 443
Verifying the DNS Setting
You also need to make sure you are properly pointing to your domain server IP. If you use IP instead of the domain name to access your site, you need to check your DNS settings.
You can use the following dig command to check whether a site is pointing to the correct IP.
dig example.com
Conclusion
I think the above troubleshooting tips helped admins track down and resolve some common issues they face when they try to start and run the site.
If you encounter any problems with the above steps, please discuss them at any time. Comment them out
Read more: String function in python
Read more: Python List sort() Method
Read more: All about Nagios Monitoring Tools
Read more: Uses of samba server and key features of the samba server