vashist99
vashist99

Reputation: 11

How to host a web page that was made using Wt(C++ Web toolkit)?

I have created a small project using Wt(C++ Web Toolkit). and I now want to host it.

Upvotes: 0

Views: 1126

Answers (2)

m7913d
m7913d

Reputation: 11064

Is LAMP needed?

LAMP is definitely not required by Wt:

  • Linux is supported, but Windows too.
  • Apache could be used as a Reverse Proxy, but some alternatives may be even better (f.ex. HAProxy)
  • MySQL is supported, but also other database backends such as Postgres.
  • PHP/Perl/Python: not needed in any way.

Reverse proxy

Using a reverse proxy is a great way to deploy your Wt application (see eisaac's answer). If you already use Apache for other websites on your server. It's perfectly ok to use it as a reverse proxy. If you don't need all the features of Apache, using a HAProxy may be the better choice. See also some deployment configuration mentioned in the Wt docs:

Easiest solution (but not scalable): let Wt directly listen on port 80 (or port 443)

If Wt is the only site running on your Ubuntu instance, you can also make it listen directly on port 80 (or port 443 in case of https):

./hello --docroot . --http-address 0.0.0.0 --http-port 80

See also the different command line options in the Wt doc: https://www.webtoolkit.eu/wt/doc/reference/html/overview.html#config_wthttpd

Upvotes: 2

user20114321
user20114321

Reputation:

This answer assumes that you have the project running locally and just need to 'get it on the web'. You have a few options...

Reverse Proxy
From the tutorial it looks like there is a built in web-server. One option could be to use this, and then setup a reverse proxy (this can be done through Apache) to map traffic from yourwebsite.com to http://localhost:port, where port is whatever you started the web-server with.

The example they give to start the local webserver is:

$ g++ -std=c++14 -o hello hello.cc -lwthttp -lwt
$ ./hello --docroot . --http-address 0.0.0.0 --http-port 9090

here, port would be 9090.

Fast CGI
From the hello world and this thread it seems like a webserver setup with FastCGI may be able to do what you are looking for. Maybe this doc from Digital Ocean can help you get started?

It seems unlikely that you specifically need the full LAMP stack (Linux, Apache, MySQL, PHP) specifically for this. The doc you link does suggest that you need to link against the appropriate library for whichever approach you take, libhttpd or libwtfcgi, and you are correct that apt would be the place to get them on Ubuntu. This is a separate issue, but maybe this answer could be a starting point?

Upvotes: 3

Related Questions