https://github.com/lrusso/webserver
Simple Node.js Web server with SSL support
https://github.com/lrusso/webserver
js node server simple ssl web
Last synced: about 1 month ago
JSON representation
Simple Node.js Web server with SSL support
- Host: GitHub
- URL: https://github.com/lrusso/webserver
- Owner: lrusso
- Created: 2024-01-27T18:47:31.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-12T02:36:33.000Z (almost 2 years ago)
- Last Synced: 2024-07-13T03:46:41.408Z (almost 2 years ago)
- Topics: js, node, server, simple, ssl, web
- Language: JavaScript
- Homepage:
- Size: 85.9 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Node.js Web Server
Simple Node.js Web server with SSL support.
## Running the Web server
* Standard ports: ```node server.js```
* Customs ports: ```node server.js 8080 4430```
## Workaround for browsing to localhost using SSL
1. Run ```node server.js```
2. Open Chrome and browse to ```https://localhost```
3. Click on ```ADVANCED```
4. Click on ```Proceed to localhost (unsafe)```
This workaround is useful for testing purposes because, for example, a Web App may require access to the webcam and that is not allowed using a non-secure connection.
## Running the Web server in the background
1. Install Forever: ```npm install -g forever```
2. Start the server: ```forever start -a -l /dev/null -c node server.js > /dev/null 2>&1```
3. Stop the server: ```forever stop -a -l /dev/null -c node server.js > /dev/null 2>&1```
## How to launch the server on startup (macOS)
- Run `nano ~/Library/LaunchAgents/com.lrusso.server.plist`
- Assuming that you have the server folder path in `/Users/lrusso/Server`, paste the following code:
```xml
Label
com.lrusso.server
ProgramArguments
/usr/local/bin/node
/Users/lrusso/Server/server.js
WorkingDirectory
/Users/lrusso/Server
EnvironmentVariables
PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin
RunAtLoad
KeepAlive
StandardErrorPath
/dev/null
StandardOutPath
/dev/null
```
- Run `chmod 644 ~/Library/LaunchAgents/com.lrusso.server.plist`
- Run `launchctl load ~/Library/LaunchAgents/com.lrusso.server.plist`