#1 2019-01-11 18:16:41

Tankard
Member
Registered: 2019-01-11
Posts: 1

Question: How to start a HTTPS Server under Linux

Hello,

could some please explain to me, how to start an HTTPS server under Linux. I didn't use try except blocks here, just to keep the pasted code smalI:

The connection to the database works. Switching to secNone, works perfectly. When I switch to secSSL, no errors will be shown, but the HTTPS connection isn't working. No data served and i get an time out. I just found some stuff for Windows.

And yes, I got a valid Let's encrypt it cert for the server. I'm using the latested mORMot and FPC compiler.

Thanks for help.

    aProps:=TSQLDBZEOSConnectionProperties.Create('zdbc:mysql://localhost','dbtest','dbuser','dbpassword');
    aModel := DataModel;
    VirtualTableExternalRegisterAll(aModel,aProps);
    // create the main mORMot server
    aRestServer := TSQLRestServerDB.Create(aModel,':memory:',false); // authentication=false
    // optionally execute all SQL requests in a single thread
    aRestServer.AcquireExecutionMode[execORMGet] := amBackgroundORMSharedThread;
    aRestServer.AcquireExecutionMode[execORMWrite] := amBackgroundORMSharedThread;
    // create tables or fields if missing
    aRestServer.CreateMissingTables;
    // serve aRestServer data over HTTPS
    aHttpServer := TSQLHttpServer.Create(SERVER_PORT,[aRestServer],'+',HTTP_DEFAULT_MODE,32,secSSL);
    aHttpServer.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries

Last edited by Tankard (2019-01-11 19:27:27)

Offline

#2 2019-01-11 20:15:46

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,606
Website

Re: Question: How to start a HTTPS Server under Linux

Under Linux, TLS is not currently supported directly.

What we usually do is to setup a Nginx proxy as fronted, and bind local host as TCP or as Unix sockets.

It is very efficient, safe, and easy to setup e.g. with Let's Encrypt for automatic renewal of the certificates.

Offline

Board footer

Powered by FluxBB