> For the complete documentation index, see [llms.txt](https://docs.neevcloud.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.neevcloud.com/neevcloud-guide/stack-automation-library/web-and-applications/nginx-web-server.md).

# Nginx Web Server

Deploys a single Instance with Nginx installed and configured, attached to a private network with a floating IP. Ready for static site hosting or reverse proxy use.

#### Architecture:

* 1 Instance (Nano — 2 vCPU, 2 GB RAM)
* 1 private network (10.200.0.0/24)
* 1 floating IP (public access)
* Security group allows HTTP, HTTPS, SSH

#### What is automated:

* Instance creation with selected flavor and image
* Private network and subnet
* Router attached to public network
* Floating IP assigned to Instance
* Security group with ports 22, 80, 443
* Nginx installed and started

#### Before you launch:

Update these parameters in the template or at launch time:

| Parameter        | Default                | What to change                                                                |
| ---------------- | ---------------------- | ----------------------------------------------------------------------------- |
| `key_name`       | `stack-test`           | **Required.** Replace with your SSH keypair name from **Compute- Key Pairs**. |
| `image`          | `Ubuntu 22.04 Updated` | Change only if you need a different OS image.                                 |
| `flavor`         | `Nano`                 | Change only if you want a different Instance size.                            |
| `volume_size`    | `30`                   | Increase if you need more disk space (in GB).                                 |
| `public_network` | `Public`               | Do not change unless your cloud has a different external network name.        |

{% hint style="info" %}
**key\_name is the only parameter you must change before launching.** Everything else works with defaults.
{% endhint %}

#### Nginx Template

Save as `nginx-server.yaml` and upload via Orchestration or Past Direct.

```
heat_template_version: 2021-04-16
description: >
  NeevCloud: Nginx Web Server with isolated network, security group, and floating IP.

parameters:
  image:
    type: string
    default: Ubuntu 22.04 Updated
  flavor:
    type: string
    default: Nano
  volume_size:
    type: number
    description: Boot volume size in GB
    default: 30
  public_network:
    type: string
    default: Public
  key_name:
    type: string
    default: stack-test

resources:
  net:
    type: OS::Neutron::Net
    properties:
      name: nginx-net

  subnet:
    type: OS::Neutron::Subnet
    properties:
      network: { get_resource: net }
      cidr: 10.200.0.0/24
      dns_nameservers: [8.8.8.8, 8.8.4.4]

  router:
    type: OS::Neutron::Router
    properties:
      external_gateway_info:
        network: { get_param: public_network }

  router_interface:
    type: OS::Neutron::RouterInterface
    properties:
      router: { get_resource: router }
      subnet: { get_resource: subnet }

  sg:
    type: OS::Neutron::SecurityGroup
    properties:
      name: nginx-sg
      rules:
        - { direction: ingress, protocol: tcp, port_range_min: 22, port_range_max: 22, remote_ip_prefix: 0.0.0.0/0 }
        - { direction: ingress, protocol: tcp, port_range_min: 80, port_range_max: 80, remote_ip_prefix: 0.0.0.0/0 }
        - { direction: ingress, protocol: tcp, port_range_min: 443, port_range_max: 443, remote_ip_prefix: 0.0.0.0/0 }
        - { direction: ingress, protocol: icmp, remote_ip_prefix: 0.0.0.0/0 }

  server:
    type: OS::Nova::Server
    properties:
      name: nginx-server
      flavor: { get_param: flavor }
      key_name: { get_param: key_name }
      networks:
        - network: { get_resource: net }
      security_groups:
        - { get_resource: sg }
      block_device_mapping_v2:
        - boot_index: 0
          delete_on_termination: true
          image: { get_param: image }
          volume_size: { get_param: volume_size }
      user_data_format: RAW
      user_data: |
        #!/bin/bash
        apt-get update -y && apt-get install -y nginx
        echo "<h1>NeevCloud Nginx Server</h1><p>Deployed via Heat Orchestration</p>" > /var/www/html/index.html
        systemctl enable nginx && systemctl start nginx

  fip:
    type: OS::Neutron::FloatingIP
    properties:
      floating_network: { get_param: public_network }

  fip_assoc:
    type: OS::Neutron::FloatingIPAssociation
    properties:
      floatingip_id: { get_resource: fip }
      port_id: { get_attr: [server, addresses, { get_resource: net }, 0, port] }

outputs:
  web_url:
    description: Web server URL
    value:
      str_replace:
        template: http://HOST
        params:
          HOST: { get_attr: [fip, floating_ip_address] }
  floating_ip:
    description: Public IP
    value: { get_attr: [fip, floating_ip_address] }
```

#### Access:

* Web: <http://floating-ip>
* SSH: ssh ubuntu\@floating-ip

#### Deploy:

1. Go to [Orchestration ](/neevcloud-products/orchestration-infrastructure-as-code/web-server-stack-template.md)in your dashboard
2. Upload or Past nginx-server.yaml
3. Select keypair, flavor, and image
4. Launch stack
