Simple HTTP Server & custom Startpage for the browser:
- on Windows using Python & Bash,
- on Linux using Lighttpd.
-
Make sure Git Bash & Python are installed (you probably do have those anyway…)
-
Make sure the
bash
&python
are added to PATHTry:
-
bash --version
, -
python --version
,
if not, add them to environmental variables, e.g.,
-
"C:\Program Files\Python\"
or"C:\Users\\[username]\AppData\Local\Programs\Python"
, -
"C:\Program Files\Git\bin"
.
-
-
Edit the directory path in
./config/scriptStartup.bat
(default:"E:\0PROGRAMOWANIE Projekty\Python WebServer HTTP\config\httpserver.sh"
) -
Edit the directory path in
./config/httpserver.sh
(default:DIR="/e/0PROGRAMOWANIE Projekty/Python WebServer HTTP/"
) -
Edit the port in
./config/httpserver.sh
(default:PORT=80
) -
Copy the
./config/scriptStartup.bat
toC:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
(copy the file$\Rightarrow$ go to StartUp dir$\Rightarrow$ paste link here, or just paste the file) -
Check status of the server w/ following command
bash E:\0PROGRAMOWANIE Projekty\Python WebServer HTTP\config\httpserver.sh" status
(remember to change the path to the ".sh" file) -
Run
bash E:\0PROGRAMOWANIE Projekty\Python WebServer HTTP\config\httpserver.sh"
to see available commands (Usage: ./httpserver.sh {start|stop|status|restart}
). Each command must include the path to the script (just Windows things, might try adding the dir path to PATH$\Rightarrow$ bash httpserver.sh status
might work, idk haven't tested)
-
Install lighttpd (
dnf install lighttpd
(Fedora KDE supremacy)) -
Open the config
sudo vi /etc/lighttpd/lighttpd.conf
(write/server_root
to find element in vi or just use different editor) -
Change the root dir
var.server_root = "/var/www"
-
Uncomment the bind to localhost
server.bind = "localhost"
-
Change port
server.port = 80
-
Change website dir
server.document-root = server_root + "/browserStartingPage"
("browserStartingPage" is the name of the directory where our website is located) -
Move the files to specified location (e.g.,
sudo mv ~/browserStartingPage/ /var/www/
) -
Enable the service, restart it (not necessary I guess) and check if it is working
systemctl enable lighttpd --now && ststemctl restart lighttpd && systemctl status lighttpd
-
Download the extension New Tab Override
-
Open settings
about:preferences#home
and go to "Home"$\Rightarrow$ "New windows and Tabs" section -
Set the "New Window" to "other" and paste the link
http://localhost
-
Open the New Tab Override extension settings, set the option to "custom" and paste the link
http://localhost