Setting up Apache on a Fedora VPS Server

Apache is one of the most popular web servers in the world and is used by many web developers to host their projects. If you have a VPS server with Fedora installed, you’ll need to configure Apache to run your website. This article will cover the basic steps for setting up Apache on a Fedora VPS server.

Step 1: Installing Apache

The first step is to install Apache on your VPS server. To do this, execute the following commands in your terminal:

sudo dnf install httpd

After installing Apache, start it and enable it to start automatically on boot:

VPS Hosting

Servidores virtuales con recursos garantizados

Elegir VPS

sudo systemctl start httpd

sudo systemctl enable httpd

Step 2: Configuring Virtual Hosts

To host multiple websites on a single server, you’ll need virtual hosts. Create a configuration file for your website, for example, /etc/httpd/conf.d/example.com.conf:

sudo vi /etc/httpd/conf.d/example.com.conf

Add the following code to the file:

ServerName example.com DocumentRoot /var/www/html/example.com

After saving the configuration file, restart Apache:

sudo systemctl restart httpd

Step 3: Firewall Configuration

To ensure the security of your server, you need to configure your firewall to allow HTTP and HTTPS traffic. Execute the following commands:

sudo firewall-cmd --zone=public --add-service=http --permanent

sudo firewall-cmd --zone=public --add-service=https --permanent

Then reload the firewall:

sudo firewall-cmd --reload

Step 4: Configuration Check

To ensure that all settings have been applied correctly, check the Apache configuration:

sudo httpd -t

If the command output contains no errors, your Apache server is configured correctly and ready to work.

You now have a working Apache web server on your Fedora VPS server. Setting up Apache might seem complex at first, but by following these steps you can easily launch your website and start attracting visitors. Good luck!