I have created a small project using Wt(C++ Web Toolkit). and I now want to host it.
- Since there are very sparse resources for this, I read somewhere that LAMP is required for this(since I am using Linux). So after creating an Ubuntu instance at Digital Ocean, I installed my code in it with Apache2, MySql, and PHP. The Apache2 server is working, but it is used for hosting HTML/CSS/JS files. my web page is written entirely in C++.
- I got directed to this website: https://www.webtoolkit.eu/wt/doc/reference/html/overview.html#wthttpd where it mentions "connectors" like
libwthttp
andlibwtfcgi
. I tried to install them usingapt
but I get this error:E: Unable to locate package libwtfcgi-dev
(same for libwthttp). - The website mentioned above also does not provide clear steps for using these connectors.
- I have also looked at other related answers : Host for Wt C++ web framework, deplowment issue but since I am new to web hosting, I would really appreciate a step-by-step guidance.
- Even here: https://redmine.webtoolkit.eu/projects/wt/wiki/Fastcgi_on_apache The language is very unclear ast to where
fastcgi.conf
is located.
2
Answers
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
tohttp://localhost:port
, whereport
is whatever you started the web-server with.The example they give to start the local webserver is:
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?
Is LAMP needed?
LAMP is definitely not required by
Wt
: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):
See also the different command line options in the Wt doc: https://www.webtoolkit.eu/wt/doc/reference/html/overview.html#config_wthttpd