Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Small and flexible web server written using the D 2.0 language

License

NotificationsYou must be signed in to change notification settings

DannyArends/DaNode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

master:Dlicence:license

Web server written in theD programming language tohost server side web applications (written in any programming language) on multiple domains.It provides encrypted HTTP content over SSL usingServer Name Identification,and has been battle tested in production for over 5 years hosting several of myweb domains, such as my ownpersonal website.

Written because I was looking for a quick way of sharingRscript output with other researchers atdifferent universities. Once working I wanted to use other programming languages aswell and added generic support for other languages. Use any language towrite your SSL encrypted homepage, why notbrainfuck, howeverAda,R orPHP are also fine.

The web servers main features / aims summarized:

Get DaNode

Install the DMD compiler fromhttps://dlang.org/

Clone the source code from Github

git clone https://github.com/DannyArends/DaNode.gitcd DaNode

Build DaNode using the dub package manager

dub build

Another option is to compile using the compile script

./sh/compile

Start the web server at a specific port (e.g. 8080)

./danode/server -p 8080

Confirm that the web server is running by going to:http://localhost:8080/

Enable HTTPs support

To compile the server with HTTPS support (binds to port 443), use dub and specifythessl configuration:

dub build --config=ssl

or, compile using the compile script:

./sh/compile ssl

Start the web server on port 80 and 443:

./danode/server

After starting the server, confirm that the web server is running by going tohttp://127.0.0.1/andhttps://127.0.0.1/ and make sure you have enough user rights to bind port 80 and 443, a serverprivate key and domain certificates are required. I use Let's Encrypt to secure my own homepage.Setup instructions for Let's Encrypt can be found in thesh/letsEncrypt file.

Troubleshooting: [ERROR] unable to bind socket on port 80

Starting the server on port 80 and 443 might fail, when you do not have appropriaterights on the system. First check if you can start the server on another port:

./danode/server -p 8080

I usenohup andauthbind to start the web server in deamon (background) mode at port 80, and 443 (SSL).First, installnohup andauthbind via your package manager, configureauthbind to allowconnections to port 80 (and 443, when using the ssl version), then start the webserver by running:

./sh/run
Command-line parameters

The content of the ./sh/run shell script:

nohup authbind danode/server -k -b 100 -v 2 > server.log 2>&1 &

This starts the server, does not allow for keyboard command (-k) has a backlog (-b)of 100 simultaneous connection (per port), and produces more log output (-v 2).

      --port      -p       HTTP port to listen on (integer)      --backlog   -b       Backlog of clients supported simultaneously per port (integer)      --keyoff    -k       Keyboard input via STDIN (boolean)      --certDir            Location of folder with SSL certificates (string)      --keyFile            Server private key location (string)      --wwwRoot            Server www root folder holding website domains (string)      --verbose   -v       Verbose level, logs on STDOUT (integer)
Example websites

See thewww/ folder for a number of example web sites. After compiling the webserver, run the web server and thewww/localhost/ folder is availableathttp://localhost/ orhttp://127.0.0.1/ from the browser. For the other examples inthewww/ folder you will have to update your hosts file.

Create a PHP enabled website

To create a simple PHP enabled web site first download and install DaNode, the nextstep is to create a directory for the new website, by executing the following commandsfrom the DaNode directory:

mkdir www/domain.xxxtouch www/domain.xxx/index.php

Add some php / html content to the index page, and create a web.config file:

touch www/domain.xxx/web.config

Add the following configuration settings to the web.config file, if you want to usescripting languages such as PHP, you have to manually allow the execution of cgi file.Add the following lines in your web.cofig file to redirect to the index.php file, andallow the webserver to execute the php script, and redirect the incomming requests tothe index.php page:

allowcgi     = yesredirecturl  = index.php
Update the hosts file

If you do not own the domain name you want to host, use the /etc/hosts file to redirectrequests from the domain name to your local IP address using the hosts file:

sudo nano /etc/hosts

Then add the following lines to this hostfile using your favourite editor:

127.0.0.1   domain.xxx127.0.0.1   www.domain.xxx

Save the file with these lines added, then open a browser and navigate to:http://www.domain.xxx, you should now see the content of your php / html file.

Supported back-end languages

Languages with supported APIs: PHP, PYTHON, D, R

See:api/README.md

Contributing

Want to contribute? Great! Contribute to DaNode by starring or forking on Github,and feel free to start an issue or sending a pull request.

Fell free to also post comments on commits.

Or be a maintainer, and adopt (the documentation of) a function.

License

DaNode is written by Danny Arends and is released under the GNU GENERAL PUBLICLICENSE Version 3 (GPLv3). SeeLICENSE.txt.

About

Small and flexible web server written using the D 2.0 language

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp