By Alain Francois
Apache is the most common web server used on Linux systems. It is a free and open-source web server that delivers web content through the Internet. One of the most common web application stacks involves Linux, Apache, MySQL, and PHP. It is called LAMP.
Apache functions as a way to communicate over networks from client to server using the TCP/IP protocol. Apache offers features, such as:
You should log in on your ECS instance first, install Apache if it is not installed yet, and check if the service is running.
$ sudo apt update && sudo apt install apache2
Make sure the service is running:
$ sudo systemctl start apache2
$ sudo dnf install httpd
Make sure the service is running:
$ sudo systemctl start httpd
Apache, in its working process, defines what user Apache is running as in the configuration files. It means you can check those files to see the user configured.
On Debian-based systems, check the configuration file /etc/apache2/apache2.conf
and look for the directive user
:
$ cat /etc/apache2/apache2.conf
The value can be set as an environment variable, so you need to look: /etc/apache2/envvars
:
$ cat /etc/apache2/envvars
You can see the user is www-data
on the Ubuntu server.
On RedHat-based systems, check the configuration file /etc/httpd/conf/httpd.conf
and look for the directive user
:
$ cat /etc/httpd/conf/httpd.conf
Here, the user is apache
on the CentOS server.
This method will show you the configured user to run Apache, but it doesn't show if other users are running Apache.
As Linux systems are multi-session, it means some others can run Apache. It will be interesting to display this sort of result. So, another way is to list all the running processes with the ps
command (with the user running them) and filter the result to only catch the Apache process.
On a Debian-based system, as the package is Apache, you should use the command below:
$ sudo ps -aux | grep apache
While on RedHat based systems, the package is httpd, so you should use the command below:
$ sudo ps -aux | grep http
On each result, you can see the previous default user.
1,076 posts | 263 followers
FollowAlibaba Cloud Community - July 5, 2022
Alibaba EMR - April 2, 2021
Alibaba Clouder - December 29, 2020
Alibaba Clouder - August 2, 2019
Alibaba Cloud Native - October 11, 2024
Apache Flink Community China - July 27, 2021
1,076 posts | 263 followers
FollowExplore Web Hosting solutions that can power your personal website or empower your online business.
Learn MoreAlibaba Cloud Linux is a free-to-use, native operating system that provides a stable, reliable, and high-performance environment for your applications.
Learn MoreA fully-managed Apache Kafka service to help you quickly build data pipelines for your big data analytics.
Learn MoreExplore how our Web Hosting solutions help small and medium sized companies power their websites and online businesses.
Learn MoreMore Posts by Alibaba Cloud Community