how to deploy a zero-config web server from the command line on macOS and serve content across your network

ยท

in order to establish a web server were going to install homebrew. It's essentially a package manager for macOS written in ruby that allows installaltion of linux packages and macstore applications.

only major difference between mac and intel is the directory where homebrew will be installed. This script works for both.

copy and paste this code in terminal to install homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

homebrew casks can be used for installation of native apps.
example: brew install --cask firefox installs the web browser from the app store only were using the command line instaed.

once homebrew is installed we are ready to grab our web server. the server in this example is called "serve". and it is installed installed with the following command

brew install serve

once it completes all thats left to do is start the web-server. typing "serve" instantly serves a local URL of the home folder that is now avaliable on the local network using port :30000

visiting the URL in a web browser now gives us direct accesss to the files of the host machine.

Screenshot-2023-05-29-at-8-37-10-PM
Screenshot-2023-05-29-at-8-44-34-PM Screenshot-2023-05-29-at-8-56-56-PM

Typing serve -h will display the commands on how to configure and interact with the server.

pressing control^ + c will stop any instances the server is running.


serve localhost:80 

serve httpd 

serve /Users/admin/Desktop

serve 10.0.0.0/8

A few more examples of the server command and how its used to launch instances from the command line. each of them working without error. small in nature however the serve package includes advanced options such as compression SSL/TLS and a built in debugging tool.


Screenshot-2023-05-30-at-2-49-42-AM

commands to keep homebrew up to date and working

brew update 

brew upgrade 

Screenshot-2023-05-30-at-3-02-19-AM

conclusion: homebrew works for both the casual and the expert. the package manager has native support for linux out the box and generally homebrew packages are better maintained and more convenient to use than the equivalent packages available in linux. Homebrew packages are designed to only provide per-user functionality, homebrew can be used alongside your system package manager without creating conflicts. It can easily be removed, does not require installation in the root, remove homebrew by running the following command.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"

a good operator: run the matrix in terminal and help NEO realize he is the chosen one

brew install cmatrix
cmatrix

Screenshot-2023-05-30-at-3-21-47-AM
Screenshot-2023-05-30-at-3-21-57-AM

a proper exit looks something like this

sudo shutdown -r now



Signal to Noise Ratio Calculator

Calculator and Formula



Jesse@JesseJesse.com