Project

General

Profile

Deploying Wt Application to Apache using FCGI

Added by Gavin Cobb almost 4 years ago

Hey all!

I have had a great time using Wt to create some Web Apps in C and have taken in so much information on this forum. Now that I've completed a few Applications, I want to showcase them on internet for everyone to see, each with a different domain name. I have some experience hosting a website on a server as I've hosted my portfolio website that was simple html, css, and javascript. However, I have little experience at all with hosting a website on a server such as apache, interfacing with fastcgi.

For a week I went through all of the deployment documentation and years of forum results, and after tons of youtube videos on apache, fastcgi, and deployment using fastcgi on apache , (which I could mostly only find for php), I've come to the point where I downloaded apache2 and tested deploying my portfolio website on apache server, and it worked perfectly as expected. I deleted the portfolio website files in www, Then I took the next step of trying to configure mod_fastcgi in Apache. I find that apache deprecated mod_fastcgi for mod_proxy_fcgi a few years ago. So the forums answer for fastcgi deployment on apache is outdated when I am trying to modify the contents of the configuration file with the .

So I took to the internet to see that mod_proxy_fcgi should work the same as mod_fcgi for my purposes. I believe it does to my knowledge but now I have no idea how to modify the configuration file because the directives are not the same as mod_fcgi. Can anyone help me figure out the directives to include and maybe help guide me through the next steps for completing deployment with Fcgi?

I feel like I may not even be going in the correct direction anymore trying to deploy my wt applications. so then I tried going back to the documentation to deploy using Haproxy and Wt built in server, which did not work well with mac as haproxy was not properly installing my config files I believe so I could not modify them. If I'm going in a direction that is harder than it needs to be please let me know and I will try another method but from my knowledge I am following steps others have used before and it has led me to this dead end that I desperately need help with as I've taken so much time just to get here. Thank you for your time.


Replies (5)

RE: Deploying Wt Application to Apache using FCGI - Added by Gavin Cobb almost 4 years ago

I forgot to mention that I have tested my applications on Wt's built in server and they work seamlessly on my local host connection. That is what I had been using to deploy my site to local host before I switched to trying fastcgi because I believe that is the only way to deploy to a server via ssh on my shared hosting service. I am new to web development though so if there is an easier way to bring my applications to the web please let me know.

RE: Deploying Wt Application to Apache using FCGI - Added by Roel Standaert almost 4 years ago

Yeah, from my own experience with it, setting up FastCGI with Wt can be a hassle. You're generally better off using an HTTP proxy instead. That proxy doesn't need to be HAProxy, though, every major web server implementation has support for proxying, like Apache (mod_proxy_http) or nginx, or Caddy, which I learned of recently, and I have never tried to use it in production, but it's stupidly easy to configure. Any option that uses HTTP proxying trumps FastCGI in my opinion.

RE: Deploying Wt Application to Apache using FCGI - Added by Gavin Cobb almost 4 years ago

Thank you for your help but this process is still giving me difficulties.

Do you think you could help me further?

I researched and concluded the same thing after looking through the forum posts with more understanding. I found a post from 2 years ago that included a question about running fastcgi behind apache and how it was outdated. The replier suggested running the WtApplication with Wt httpd in a docker container, and then running the apache2 server in docker with a virtual host to the Wt Application with something like

<VirtualHost :>

ServerName wtapp.mooo.com

ProxyPass "/google8f3c4b0fd5a2cacd.html" !

ProxyPass "/" "http://wtapp/"

ProxyPreserveHost On



So when someone requests wtapp.mooo.com, traffic is forwarded to wtapp (the docker container running my wt app).

However, I have some questions:

Where should I add the configuration above in apache? I believe I should add it to the httpd.conf file, but I am unsure now.

What is the directive that says ProxyPass "/google8f3c4b0fd5a2cacd.html" ! supposed to do?

Is this all I would need to do for a safe deployment?

He then says that this can be run without docker which is what I am going to try first on my machine. It makes sense that it should work to my knowledge.

All I would have to do is run the application on my machine with the wt httpd then run my apache server with a virtual host configured to the wt application and change the proxypass directive to ProxyPass "/wtapp/" "http://localhost:9090/wtapp/"

A last question for this aspect is where should wtapp be located and should I only include the files for my application that I would need to deploy it as usual?

RE: Deploying Wt Application to Apache using FCGI - Added by Roel Standaert almost 4 years ago

That configuration can go anywhere, really. I know some distributions organize it a bit (Debian and Ubuntu have sites-available/sites-enabled, etc.).

That ProxyPass "/google8f3c4b0fd5a2cacd.html" ! is probably because they had an HTML file to prove to Google that they were the owner of that domain, and they didn't want requests for that to go to Wt.

You'll also want to indicate that Wt is behind a reverse proxy by setting <behind-reverse-proxy> to true in wt_config.xml.

RE: Deploying Wt Application to Apache using FCGI - Added by Gavin Cobb almost 4 years ago

Hey just wanted to say I deployed my application and its currently running right now! I pretty much did exactly what you said. I ended up using digital ocean as my VPS and ran a reverse proxy behind it between my apache2 server that send the requests to the built in wthttpd server. May use docker for the container functionality in the future. Thank you for all the help!

    (1-5/5)