Serves directory over HTTP & HTTPS
Serves directory over HTTP & HTTPS on Ubuntu Server LTS
- Install dependencies:
sudo apt-get update
sudo apt-get install -y npm
- Install Node.js:
sudo apt-get install -y nodejs
- Clone this repository:
git clone https://github.com/dibend/localweb.git
- Navigate to the cloned repository:
cd localweb
- Install dependencies using npm:
npm install
- Create a folder named ssl and add ssl key and cert named localweb.key and localweb.crt:
mkdir ssl
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ssl/localweb.key -out ssl/localweb.crt
- Create a file named
config.json
with the following content:
{
"dir": "/home/share",
"user": "your_username",
"password": "<your_password_here>"
}
- Start the server:
node server.js
To access your files using HTTP Basic Auth, open a web browser and navigate to http://your_server_ip:port
(replace with the actual IP address and port number of your server). You will be prompted to enter a username and password. Enter your_username
as the username and <your_password_here>
as the password.
Note: Make sure to replace your_username
and <your_password_here>
with your actual desired credentials.
node server.js
To access your files using HTTP Basic Auth, open a web browser and navigate to `http://your_server_ip:port` (replace with the actual IP address and port number of
your server). You will be prompted to enter a username and password. Enter `your_username` as the username and `<your_password_here>` as the password.
Note: Make sure to replace `your_username` and `<your_password_here>` with your actual desired credentials.