How To Install Sguil Centos. Welcome to LinuxQuestions.org, a friendly and active Linux Community. You are currently viewing LQ as a guest.
CentOS 8 is the latest release of CentOS Linux operating system, which is based on Red Hat Enterprise Linux 8. In this tutorial we will help you to install Apache web server on CentOS 8 or RHEL 8 system with additional configuration and security.
Prerequsities
- SSH access to CentOS/RHEL 8 system
- Sudo privileges to user to install packages
Install Apache on CentOS 8
First of all, Login to your CentOS 8 or RHEL 8 system via SSH. Then install Apache2 HTTP server packages using the following command. This will also install additional required packages on your system.
Wait for the installation complete
Manage Apache Service
Apache service is managed with systemctl command line on CentOS/RHEL 8. After installation, use the following command to enable the Apache service and then start it.
Here is the other commands to stop and restart Apache service via command line.
Test Apache Setup
You can view the installed Apache version details using the following command.
Create a test html page under default document root directory (/var/www/html).
Now access your Apache server using the server’s IP address or a domain pointed to the server IP.
Create Virtual Hosts
Let’s create the first virtual host on your Apache server. For the tutorial, we are using sample domain “example.com”. Here we will create a Virtual host for example.com on port 80.
Create a sample index file in a directory:
Then create Virtualhost configuration file and edit in editor:
Add the following content at the end of the configuration file. You may change the domain name as per your domain.
For the tutorial, I have followed these instructions to generate a self signed SSL certificate for our domain.
You can either use /etc/httpd/conf/ssl.conf for SSL virtual host or You can use a separate Virtual host configuration file for your domain. For example:
with the following content:
2 4 6 8 10 12 14 16 18 | # Requires Apache 2.4.36 & OpenSSL 1.1.1 SSLOpenSSLConfCmdCurvesX25519:secp521r1:secp384r1:prime256v1 # SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 HeaderalwayssetStrict-Transport-Security'max-age=63072000; includeSubDomains; preload' HeaderalwayssetX-Content-Type-Optionsnosniff SSLCompressionoff SSLStaplingCache'shmcb:logs/stapling-cache(150000)' SSLSessionTicketsOff |
After making changes restart the Apache service to apply new configuration.
Conclusion
All done, You are running a secured Apache server on your CentOS 8 or RHEL 8 Linux system.