Open apogorzelska opened 1 year ago
im unfamiliar with caddy but i heard it's good
Never used Caddy because other solutions are easier if you have multiple docker containers which may not be websites running.
But since rssbridge is basically just a website which requires nothing special, try this in your caddyfile:
rssbridge.yourwebsite.url {
reverse_proxy YOURRSSBRIDGECONTAINERNAME:80
}
the first entry is obviously your supposed subdomain. This defines what caddy should do when a request comes to this url. The reverse_proxy will only do that proxying. Proxy this to the name of your rssbridge container (use the docker "container_name" directive to define that in your compose file) and port.
If you want to "try something else", look at SWAG from LSIO or Cosmos UI (relatively new but I've been testing it for a while and its pretty cool. I also added rssbridge to it :) )
Thank you for your answer, I'm sure if I was running RSS-Bridge with Docker that would work flawlessly. However, I'm not using Docker on my VPS. I installed RSS-Bridge through following commands:
apt install php-fpm php-mbstring php-simplexml php-curl
cd /var/www
git clone https://github.com/RSS-Bridge/rss-bridge.git
I then attempted my best to deduce from various sources how to translate RSS-Bridge's Nginx config to a Caddy config, and added the following to Caddyfile (I changed my domain to example.com for privacy):
rss-bridge.example.com {
root * /var/www/rss-bridge
php_fastcgi unix//run/php/php-fpm.sock {
index index.php
root /var/www/rss-bridge
read_timeout 60s
}
file_server
}
I then run the following to make sure the Caddyfile doesn't have errors, and restarted Caddy:
cd /etc/caddy
sudo caddy fmt --overwrite
sudo caddy validate
systemctl restart caddy
However, when I try to go to rss-bridge.example.com, all I see is a blank page. I'm not sure what I'm doing wrong - am I perhaps missing some crucial basic step in running a PHP site in general that would be obvious to a PHP developer, or is the config still wrong in some way?
I would appreciate any further help.
Further update: Looks like the page loads now! For the folks facing similar problems in setting up RSS-Bridge, know that I changed two things (but I think 1 was the one that was the actual issue):
1) I changed permissions for the rss-bridge folder:
chmod -R a+rwx /var/www/rss-bridge
2) I switched up the socket for a port (apparently the socket thingy can be troublesome in some cases?), with following steps:
I changed up the following config:
nano /etc/php/7.4/fpm/pool.d/www.conf
by switching the socket to a port, like so:
;listen = /run/php/php7.4-fpm.sock
listen = 127.0.0.1:7345
After saving, I made sure to refresh fpm:
systemctl restart php7.4-fpm
systemctl status php7.4-fpm
And then I changed the socket to a port in Caddyfile, and repeated the steps to check Caddyfile validity and restart Caddy:
rss-bridge.example.com {
root * /var/www/rss-bridge
php_fastcgi 127.0.0.1:7345 {
index index.php
root /var/www/rss-bridge
read_timeout 60s
}
file_server
}
Giving everyone rwx is probably not a good practice for public facing websites.
If I was you, i would join the caddy discord and ask there if this is a good approach or if theres an easier way.
After some figuring things out, in the end I set it up as following:
I edited following config:
nano /etc/php/7.4/fpm/pool.d/www.conf
by switching up the user and group to Caddy's:
user = caddy
group = caddy
After saving the config, I made sure to refresh fpm:
systemctl restart php7.4-fpm
systemctl status php7.4-fpm
sudo chown -R caddy:caddy /var/www/rss-bridge
sudo chmod -R 2770 /var/www/rss-bridge
If I understand correctly, this way only the folder's owner user+group has access to the folder.
there is recent changes to README.md related to this
Is your feature request related to a problem? Please describe. I'm not sure how to correctly configure Caddy 2 to serve RSS-Bridge on my VPS (I'm relatively new to self-hosting).
Describe the solution you'd like Add an example Caddyfile to installation instructions in documentation.
Describe alternatives you've considered I tried googling but I didn't get a definitive answer on how to achieve it.