💾 Archived View for bbs.geminispace.org › s › Gemini › 14574 captured on 2024-02-05 at 09:46:43. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
One-line ncat Gemini server
ncat --ssl -l -k -p 1965 -c "/usr/bin/echo -e \"20 text/gemini\r\nhi\r\n\""
ncat --ssl -l -k -p 1965 -c "/usr/bin/echo -e \"20 text/gemini\r\nhi\r\n\""
Then go to gemini://localhost/ to view. It should display "hi".
If you would like to create a certificate for your server instead of having it generate a new one every time (and thus get security warnings every time) you can do the following:
1) Create a certificate in Lagrange called localhost (or whatever the name of your server is.)
2) Click on it and choose "Show in File Manager".
3) copy it somewhere and rename the file that ends in .crt to a.crt and the file that ends in .key to a.key.
4) Type the following in the terminal.
ncat --ssl --ssl-cert a.crt --ssl-key a.key -l -k -p 1965 -c "/usr/bin/echo -e \"20 text/gemini\r\nhi\r\n\""
Then go to gemini://localhost/ to view. It should display "hi".
If you'd like to make an HTTPS web server instead:
ncat --ssl -l -k -p 9965 -c "/usr/bin/echo -e \"HTTP/1.1 200\r\n\r\nhi\r\n\""
Then go to https://localhost:9965/ in a web browser.
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Feb 01 · 4 days ago · 👍 november · 🤔 1
🚀 skyjake [mod...] · Feb 02 at 04:03:
You might want to apply some preformatted blocks here...