I do not have access to httpd.conf from Apache as this is a shared host.
Talk to your hosting provider. They should be able to tell you which of the many possible proxy modules are available to you and how to set up (basic) proxy configuration to get you started.
| [reply] |
| [reply] |
Trying to get support from the hosting provider. They can't modify the httpd.conf because I'm on a shared host. And I tried the other solutions in .htaccess and I can't seem to get that working...crossing my fingers. | [reply] |
To explain some more details about the Dancer documentation for Apache, where they say
As a CGI Script
...
AddHandler cgi-script .cgi
...
They are suggesting that each incoming request would launch a new one-shot call to perl running your Dancer app to serve a single request. This is slow and nobody wants to do it like this.
Where the documentation says
As a FastCGI Script
...
You will still need to enable mod_rewrite, but will need to use a FastCGI module instead of a CGI module. There are 3 available: mod_fcgid, mod_fastcgi and mod_proxy_fcgi. For this example, we will use mod_fastcgi (a2enmod fastcgi in Debian).
...
FastCgiServer /srv/www.example.com/public/dispatch.fcgi
...
AddHandler fastcgi-script .fcgi
they are saying that your apache hosting provider needs to have one of those three fastcgi modules installed (you'll have to ask them if any are available). That module will see your .htaccess file and load a long-running copy of your application, consuming server resources based on how many workers you configure. This is what you want, but may not be something your hosting provider wants.
Checking with ChatGPT,
No, the FastCgiServer directive is not typically allowed in an .htaccess file.
which agrees with the general lack of google results for that example.
I will second the opinion of others that shared hosting providers are not something you want to use for perl web apps. The shared-hosting-behind-apache model was popular 20 years ago, but it has numerous problems and everyone generally hated it, and we've all moved on (except PHP folks, for whom it still kind of works)
There's a bigger learning curve, but I recommend getting comfortable with managing your own virtual machine on a cloud platform like Linode or Digital Ocean. Their small instances are $5/mo and are plenty for running a perl web app with small userbase. Having your own VM puts you in full control of apache, or you could ditch apache and use nginx, or Traefik. Traefik gives you free SSL certs and is a fairly nice experience compared to apache; it doesn't serve static files though.
If you've never managed your own host before and want to skip the learning curve, DigitalOcean also has the App service which deploys one of your GitHub repos directly into a VM for you, so all you have to do is push changes to your GitHub repo and poof, they're available with SSL served from a VM. Here's a blog article I found that sums it up.
| [reply] |
| [reply] |
Switch off of a shared host. There are really cheap alternatives where you can get a VPS for like $3/mo (example, racknerd.com).
Celebrate Intellectual Diversity
| [reply] |