Practical Example
This document provides a practical example of configuring security groups and setting up a web server (Apache or Nginx) on a Virtual Machine (VM) in OpenStack. The example includes steps using both the Horizon Dashboard and the OpenStack CLI.
Configure Security Groups
-
Create a security group:
- Navigate to Project > Network > Security Groups.
- Click Create Security Group.
- Provide a name (e.g.,
web-server-sg
) and optional description. - Click Create Security Group.
-
Add ingress rules:
- Select the
web-server-sg
security group. - Click Manage Rules.
- Click Add Rule.
-
Add rule for
SSH
(in order to connect to your instance):- Rule:
SSH
- Remote:
CIDR
- CIDR:
0.0.0.0/0
- Click Add.
- Rule:
-
Add rule for
HTTP
:- Rule:
HTTP
- Remote:
CIDR
- CIDR:
0.0.0.0/0
- Click Add.
- Rule:
-
Add rule for
HTTPS
:- Rule:
HTTPS
- Remote:
CIDR
- CIDR:
0.0.0.0/0
- Click Add.
- Rule:
- Select the
-
Create a security sroup:
-
Add ingress rules
Launch and Configure the VM
-
Launch a new instance:
- Navigate to Project > Compute > Instances.
- Click Launch Instance.
- Fill in the instance details:
- Instance Name:
web-server-instance
- Flavor: Select the appropriate flavor.
- Image: Select the desired image (e.g.,
Ubuntu 22.04
)
- Instance Name:
- Under Networks, select the appropriate network.
- Under Security Groups, select
web-server-sg
. - Click Launch Instance.
-
Install a web server:
ssh
into the instance.- Update the package list and install Apache or Nginx.
-
Launch a new instance:
-
Access the VM:
- Connecting to the instance in IPv4 subnet requires a Router and the Floating IP. For instructions on how to establish these, visit the articles Create a Router and Create and Manage Floating IPs.
-
Install a web server:
- Update the package list and install Apache or Nginx.
- Start the web server:
Test the Setup
Open a web browser and navigate to the public IP address of the instance. You should see the default Apache or Nginx welcome page, confirming that the web server is accessible.
This example demonstrates how to create and configure security groups in OpenStack, launch an instance, and install a web server using both the Horizon Dashboard and OpenStack CLI. By following these steps, you can ensure your web server is properly secured and accessible over HTTP and HTTPS.