Время на прочтение
2 мин
Количество просмотров 13K
Под катом краткая инструкция по установке и настройке вышеуказанной связки. Через поиск не нашел, когда ставил для себя пришлось порыться по инету.
Шаг первый.
Качаем и ставим Lighttpd для Windows.
Шаг второй.
Качаем и ставим питон для Windows.
Шаг третий.
Настраиваем конфиги, идем в C:\Program Files\LightTPD\conf и правим файл lighttpd-inc.conf, а именно:
Раскомментировать
server.modules = ( ... "mod_cgi", "mod_rewrite", ... )
Задать полный путь к каталогу в котором будет находиться наш базовый сайт, задать нужно полностью (pytрon.exe не будет исполнять .py файлы по относительным путям) и с прямым слэшем.
server.document-root = "C:/Program Files/LightTPD/HTDOCS/"
Добавить описание заголовочного файла на питоне:
index-file.names = ( "index.py", "index.php", "index.pl", "index.cgi", "index.html", "index.htm", "default.htm" )
Занести питоновские файлы в исключения, чтобы не относить его к статическому контенту:
static-file.exclude-extensions = ( ".php", ".pl", ".cgi",".py" )
И самое главное, указываем полный путь к местанахождению интерпретатора питона:
cgi.assign = ( ".py" => "C:/Python27/python.exe")
Если 80 порт уже используется каким-либо веб-сервером или приложением стоит проверить строку с привязкой к порту и изменить на свободный:
server.port = 81
Запускаем Lighttpd сервер (C:\Program Files\LightTPD\TestMode.bat)
Шаг четвертый.
Создаем тестовый файл на питоне. Я использовал следующий код:
#!C:\Python27\python.exe -u
#!/usr/bin/env python
import cgi
import cgitb; cgitb.enable() # for troubleshooting
print "Content-type: text/html"
print
print """
<html>
<head><title>Sample CGI Script</title></head>
<body>
<h3> Sample CGI Script </h3>
"""
form = cgi.FieldStorage()
message = form.getvalue("message", "(no message)")
print """
<p>Previous message: %s</p>
<p>form
form method="post" action="index.py"
<p>message: <input type="text" name="message"/></p>
</form>
</body>
</html>
""" % cgi.escape(message)
Но конечно можно ограничиться и более простым
print "hello";
Называем файл index.py и ложим по пути C:\Program Files\LightTPD\htdocs.
Тестируем вбив в адресную строку:
http://localhost:81/index.py
, должно работать и просто
http://localhost:81
Тестировалось на Windows Server 2008 R2 x64. Должно по идее работать на любой версии ОС.
I got application server running in Windows – IIS6.0 with Zend Server to execute PHP. I am looking for lightweight static content only web server on this same machine which will relive IIS form handling static content and increase performance.
It need to be only static content web server – maximum small and maximum effective – lighttpd seems too big because allow to FastCGI.
I am looking for: Windows, static content only, fast, and lightweight.
I am using Windows Server 2003.
halfer
19.9k17 gold badges102 silver badges189 bronze badges
asked Feb 19, 2011 at 12:48
14
You can use Python as a quick way to host static content. On Windows, there are many options for running Python, I’ve personally used CygWin and ActivePython.
To use Python as a simple HTTP server just change your working directory to the folder with your static content and type python -m SimpleHTTPServer 8000
, everything in the directory will be available at http:/localhost:8000/
Python 3
To do this with Python, 3.4.1 (and probably other versions of Python 3), use the http.server
module:
python -m http.server <PORT>
# or possibly:
python3 -m http.server <PORT>
# example:
python -m http.server 8080
On Windows:
py -m http.server <PORT>
Lii
11.6k8 gold badges65 silver badges88 bronze badges
answered Feb 26, 2011 at 17:17
eSniffeSniff
5,7331 gold badge27 silver badges31 bronze badges
14
Have a look at mongoose:
- single executable
- very small memory footprint
- allows multiple worker threads
- easy to install as service
- configurable with a configuration
file if required
Bruno Brant
8,2757 gold badges46 silver badges90 bronze badges
answered Feb 25, 2011 at 15:50
ARFARF
7,4709 gold badges45 silver badges73 bronze badges
19
The smallest one I know is lighttpd.
Security, speed, compliance, and flexibility — all of these describe lighttpd (pron. lighty) which is rapidly redefining efficiency of a webserver; as it is designed and optimized for high performance environments. With a small memory footprint compared to other web-servers, effective management of the cpu-load, and advanced feature set (FastCGI, SCGI, Auth, Output-Compression, URL-Rewriting and many more) lighttpd is the perfect solution for every server that is suffering load problems. And best of all it’s Open Source licensed under the revised BSD license.
- Main site: http://www.lighttpd.net/
Edit: removed Windows version link, now a spam/malware plugin site.
Tracker1
19.1k12 gold badges80 silver badges106 bronze badges
answered Feb 27, 2011 at 6:56
Ophir YoktanOphir Yoktan
8,1877 gold badges59 silver badges106 bronze badges
8
Consider thttpd. It can run under windows.
Quoting wikipedia:
«it is uniquely suited to service high
volume requests for static data»
A version of thttpd-2.25b compiled under cygwin with cygwin dll’s is available. It is single threaded and particularly good for servicing images.
Synetech
9,6439 gold badges64 silver badges96 bronze badges
answered Feb 26, 2011 at 17:39
James CrookJames Crook
1,60012 silver badges17 bronze badges
Have a look at Cassini. This is basically what Visual Studio uses for its built-in debug web server. I’ve used it with Umbraco and it seems quite good.
answered Feb 19, 2011 at 13:28
ProfKProfK
49.3k123 gold badges402 silver badges778 bronze badges
1
I played a bit with Rupy. It’s a pretty neat, open source (GPL) Java application and weighs less than 60KB. Give it a try!
answered Feb 25, 2011 at 16:57
das_weezuldas_weezul
6,0822 gold badges28 silver badges33 bronze badges
1
answered Feb 28, 2011 at 9:32
ypercubeᵀᴹypercubeᵀᴹ
113k19 gold badges175 silver badges236 bronze badges
Antony
14.9k10 gold badges46 silver badges74 bronze badges
answered Sep 4, 2011 at 14:05
luchaninovluchaninov
6,8126 gold badges60 silver badges75 bronze badges
1
A simple and light-weight Http server for Windows. This product is ideal for hosting static html-only websites. The program provides the basic functionality of a web server. Its simplicity make it perfect for unexperienced users with little knowledge in using servers. The server offers the opportunity to start your career as a web developer. You can also customize the program to fit your needs, add new features and contribute to the project in other various ways. I will appreciate each contribution.
Some of its notable features are:
- Asynchronous request processing
- Simple to no configuration (can be started without configuration file)
- Stability
- Supports both HTTP and HTTPS
- Server-site scripting is not supported, which makes it more secure.
- Runs on both x32 and x64 CPU architecture.
- Simple, tidy, clean and well-documented API with the possibility to easily add new features.
The program is also fast and not resource-consuming. For example, the memory usage can drop below 2 mb.
Getting Started
Before using Http Server, you must ensure that the latest supported version of Visual C++ Redistributable is installed on your machine.
Follow these steps to start Http Server for the first time.
-
Download from the latest release
Http_Server_x32.exe
orHttp_Server_x64.exe
depending on your architecture. -
After that, create a folder named
PageDir
in the same path as the executable. -
In
PageDir
create a file and name itindex.html
. -
Paste the following HTML code into
index.html
:<html> <head> <title>Home</title> </head> <body> <h1>Hello from HTTP Server! This is my index page.</h1> </body> </html>
-
Now run the Command prompt as administrator, change the directory to that of the executable and type the following command:
"Http_Server_x32.exe" noconf
or respectively"Http_Server_x64.exe" noconf
. This way you will start the server without configuration file.
All properties are set to the defaults.
An output like this:Info: Chosen schema: http Info: Host name: + Info: Port name: 80 Info: Max request threads: unlimited
indicates that the program has been started successfully.
-
Visit http://localhost:80 and you will see the
index
page on your browser. -
To exit, you move the focus on the console and press Ctrl+C.
This short tutorial shows how easy is to use Http Server. This program will serve great on your hosting and testing purposes. After you learn how to use it, you will have the basics to learn using much more complicated web software.
You can learn how to configure the server here
Documentation
The documentation is available here.
Contacts
You can contact me on email ivan.venkov.developer@gmail.com.
-
Overview
Simple, minimalist web server for testing and debugging purposes. Runs as a Windows application only.
It’s free for commercial and non-commercial use.
The server is extremely simple to use. Just unpack the ZIP file, run the executable, and that’s all. You can tweak the configuration later if needed.
Download — Tiny Web Server Application »
- Download and unpack the ZIP package.
- Optional: edit RebexTinyWebServer.exe.config.
- Run RebexTinyWebServer.exe
- Press Start button to begin serving files via HTTP/HTTPS.
- Accessible via HTTP and HTTPS protocols.
- TLS 1.3/1.2 support and up-to-date TLS cipher support.
- Legacy TLS 1.1/1.0 supported as well.
- Detailed activity log (optional raw communication logging).
- Free to use, even for commercial purposes.
- Runs on any Windows OS with .NET 4.6 or higher.
- No setup needed. Just unpack the ZIP file and run.
When to use Rebex Tiny Web Server
-
Local web development and testing
Need to test your web page now? Not willing to wait days or weeks
for your tech-support department to install a testing web server?
Don’t want to spend hours learning how to configure a full-features web
server yourself?Get Tiny Web Server and start testing your HTML pages over HTTPS in minutes.
-
Need temporary local web server for connectivity testing
Install Tiny Web Server, run it and try connecting from your devices.
When NOT to use Rebex Tiny Web Server
-
Need a production web server
Tiny Web Server is meant for testing and debugging purposes only.
It is not intended for Internet-facing endpoints.
Compatibility
Tiny Web Server runs on:
- Windows 11, 10, 8.1, 7.
- Windows Server 2019, 2016, or 2012.
- Windows Vista, Server 2008. You might have to install .NET 4.6 first when using the server on these legacy systems.
Configuration
The server can be configured using RebexTinyWebServer.exe.config
file.
This configuration file must be placed in the same folder as the executable file.
httpPort
-
TCP port on which the server listens for HTTP connections.
If not specified, the HTTP is disabled. httpsPort
-
TCP port on which the server listens for HTTPS connections.
If not specified, the HTTPS is disabled. webRootDir
-
Root data folder. If the folder does not exist,
the server creates it and puts some test data there.
Default is./wwwroot
. defaultFile
-
Default file to be sent if the request URL points to a directory.
Default isindex.html
. serverCertificateFile
-
Path to the server certificate with associated private key.
PKCS #12 (.pfx file extension) format is supported.
A new self-signed certificate is generated if it does not exist:.pfx
file is intended to be used on the server..cer
file is intended to be installed on the client into
the «Trusted Root Certification Authorities» store.
For more information, read our
Introduction to Public Key Certificates.
Default isserver-certificate.pfx
. serverCertificatePassword
- Password for the server certificate.
autoStart
-
If set to
true
, the server starts when application is started.
No need to press the button.
Default isfalse
.
Note:
To minimize possible «port in use» conflict, the initial values of ports are assigned to 1180 for HTTP and 11443 for HTTPS.
If you need to test your web client with standard ports, please modify httpPort
and httpsPort
in the configuration file to 80 for HTTP and 443 for HTTPS and make sure there is no other service using those ports.
Version history
1.0.0 (2022-02-22)
- First version.
Contact
Have a feature request or a question? Contact us or ask
at Rebex Q&A Forum.
Coding, Flash Disk, Flash Drive, Free Software, fun with code, How To, HTTP, i12bretro, Install Guide, IT Toolbox, lighttpd, On the Go, PHP, PHP Developer, PHP Web Server On A Flash Drive, Portable, Portable PHP Web Server, Portable Software, system administrator, Tutorial, USB, Web, web developer, Web Server, Web Server Administration, Windows
1 Minute
View interactive steps on GitHub
Things You Will Need
- A USB flash drive, at least 8 GB https://amzn.to/3wkR5ju | https://amzn.to/3qkrJ1p | https://amzn.to/3Nhu9b9
- Download lighttpd for Windows Download
- Download Microsoft Visual C++ Download
- Install Microsoft Visual C++
- Extract the lighttpd .zip file
- Copy the extracted lighttpd folder to the root of a USB flash drive
- Navigate to /lighttpd and double click lighttpd.exe to start the portable web server with the default configuration
Add PHP Support (Optional)
- Download the zip version of PHP for Windows Download
- Extract the downloaded PHP .zip file
- Copy the extracted PHP files to /lighttpd/PHP
- Navigate to /lighttpd/conf and edit lighttpd.conf in a text editor
- Add the following lines to lighttpd.conf
cgi.assign = ( «.php» => server_root + «/PHP/php-cgi.exe») - Find static-file.exclude-extensions and add «.php» to the listing
- Find index-file.names and add «index.php» to the listing
- Find mod_cgi and remove the # to uncomment it
- Save the changes to lighttpd.conf
- Navigate to /lighttpd and double click lighttpd.exe to start the portable web server with PHP support
Published