Skip to content

Simple web server options

Estimated time to read: 5 minutes

  • Originally Written: February, 2026

Overview

Sometimes I need a place to host files (e.g. iso files or switch/router .bin images) and have access to them in my lab. So I'm writing this to keep track of install instructions for a few HTTP servers.

Python

This is great if you need a temporary solution for quick file sharing or testing. I've found that some clients might not be able to access these files and in those cases I've used one of the next two options. I'll try and remember to document the clients in the future if it happens again.

The setup is pretty easy; just change directory to where the files are that you want to serve. Then use the Python http.server module to run a server on a specific port (8000 in this example)

cd /path/to/files/to/serve
python3 -m http.server 8000

More details: https://docs.python.org/3/library/http.server.html

Apache

I find either of the next two options work fine for a permanent HTTP server and the installation is straightforward.

sudo apt update && sudo apt upgrade -y
sudo apt install apache2 -y
sudo systemctl status apache2

Working with Apache

  • Location of files to serve: /var/www/html
    • You can created whatever structure you need however I normally have a sub-directory such as software to use as the root and then new sub-directories whenever needed
    • mkdir /var/www/html/software
  • Config files: /etc/apache2/
    • I haven't modified any config in these examples
  • Log files (troubleshooting): /var/log/apache2/
sudo systemctl start apache2
sudo systemctl stop apache2
sudo systemctl restart apache2
sudo systemctl reload apache2

If you run into issues check the permissions and make sure you have the correct config. Apache on Ubuntu runs as the www-data user. You can give this user ownership of the software directory and everything in it.

sudo chown -R www-data:www-data /var/www/html/software

The directories and files require different permissions

  • Directories need 755 (so Apache can enter them).
  • Files need 644 (so Apache can read but not modify them).
sudo find /var/www/html/software -type d -exec chmod 755 {} \;
sudo find /var/www/html/software -type f -exec chmod 644 {} \;

Nginx

You might run into 403 Forbidden errors. If this happens make sure you have the correct permissions and allow the location of the /software folder to show all files. See the section below for some screenshots and commands.

sudo apt update && sudo apt upgrade -y
sudo apt install nginx -y
sudo systemctl status nginx

Working with Nginx

  • Location of files to serve: /var/www/html
    • You can created whatever structure you need however I normally have a sub-directory such as software to use as the root and then new sub-directories whenever needed
    • mkdir /var/www/html/software
  • Config files: /etc/nginx/
    • I modified the sites config file (/etc/nginx/sites-available/default) which you can see below
  • Log files (troubleshooting): /var/log/nginx/
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
sudo systemctl reload nginx

If you run into issues check the permissions and make sure you have the correct config. Nginx on Ubuntu runs as the www-data user. You can give this user ownership of the software directory and everything in it.

sudo chown -R www-data:www-data /var/www/html/software

The directories and files require different permissions

  • Directories need 755 (so Nginx can enter them).
  • Files need 644 (so Apache can read but not modify them).
sudo find /var/www/html/software -type d -exec chmod 755 {} \;
sudo find /var/www/html/software -type f -exec chmod 644 {} \;

If you're using a sub-directory such as /software then you need to add a location block inside the sites config file.

sudo nano /etc/nginx/sites-available/default
server {
    listen 80 default_server;
    root /var/www/html;
    index index.html index.htm;

    server_name _;

    # This is the existing default block
    location / {
        try_files $uri $uri/ =404;
    }

    # This is the new block
    location /software {
        autoindex on;        # Enables directory listing
        allow all;           # Ensures access is allowed
    }
}

Comments