Apache is a web server that handles requests from clients and serves the web pages or files. RunCloud provides its own Apache package that is different from the default one in Ubuntu. Therefore, the Apache package name is changed to apache2-rc
to avoid conflict with the Ubuntu repository.
Apache Basic Commands
You don’t have to run any of these commands if you’re managing your server through the RunCloud Panel. However, if you want to manually control the Apache service, you can use these commands in the terminal.
For example:
If you want to start the Apache service, you can use:
systemctl start apache2-rc
This will start the Apache service and make it ready to serve the web applications.
If you want to stop the Apache service, you can use:
systemctl stop apache2-rc
This will stop the Apache service and make it unavailable to serve the web applications.
If you want to test the Apache configuration for syntax errors, you can use:
apachectl -t
This will check the Apache configuration files and report any errors or warnings. This is useful before you reload or restart the Apache service to make sure that the configuration is valid.
If you want to reload the Apache service, you can use:
systemctl reload apache2-rc
This will reload the Apache configuration without stopping the service. This is useful when you make some changes to the Apache configuration and want to apply them without interrupting the service.
If you want to restart the Apache service, you can use:
systemctl restart apache2-rc
This will stop and start the Apache service again. This is useful when you want to clear the cache or fix some errors.
If you want to enable the Apache service to start automatically after reboot, you can use:
systemctl enable apache2-rc
This will create a symbolic link that tells the system to start the Apache service when the system boots up.
If you want to disable the Apache service from starting automatically after reboot, you can use:
systemctl disable apache2-rc
This will remove the symbolic link that tells the system to start the Apache service when the system boots up.
Apache Location
RunCloud Apache is installed and configured in different locations from the default ones in Ubuntu. You can find the Apache installation and configuration files in the following locations:
- Installation location:
/RunCloud/Packages/apache2-rc
- Main configuration file:
/etc/apache2-rc/httpd.conf
Web Application Config
Each web application has its own Apache configuration file that defines the server settings, such as the server name, document root, error log, access log, etc. You can find the web application configuration file in the following location: /etc/apache2-rc/conf.d/*.conf
For example, if your web application name is myapp, the configuration file will be located inside /etc/apache2-rc/conf.d/myapp.conf
Do not change this config manually since it will be overwritten by RunCloud when rebuilding web application config. You can manage your web application config from the RunCloud panel.
Multi-Processing Modules (MPM)
Apache uses Multi-Processing Modules (MPM) to handle the requests from clients and serve the web pages or files. RunCloud uses the ‘event MPM‘ by default, which makes use of multiple threads and creates multiple tasks at once. This improves the performance and scalability of the web server.
However, if the event MPM doesn’t work with your configuration, you can change it to the worker MPM, which uses multiple processes and multiple threads per process.
To change the MPM setting, you need to edit the main configuration file by using the following command:
nano /etc/apache2-rc/httpd.conf
In the configuration file, you will find the following lines:
Change the event MPM to the worker MPM by commenting out the first line and un-commenting the second line. It should look like this:
After that, save your Apache config and restart Apache service:
systemctl restart apache2-rc
To check your Apache server configuration, you can use the following command:
httpd -V
This will show you the information about the Apache version, architecture, and MPM. You should see something like this:
In the above screenshot, we can see the line that says Server MPM: event
. This indicates that the worker MPM is not in use. You can also see the threaded and forked settings for the worker MPM.