Install Icecast2 with Hestia

Hi All!

I am trying to install Icecast2 on an Ubuntu 24.04 server running Hestia (Oracle Cloud). I have several domains installed and I plan to use one of those domains for Icecast.

I tried the default Icecast installation from here but when I set the nginx configuration it broke everything and I got a “421 Misdirect” error. I managed to fix that error (based on this post) and all sites work OK again.

Does anyone managed to install Icecast successfully? Please let me know how I can do that.

Specifically, the problem I have is changing the nginx configurations as per the following instructions:

Step 2 – Configure Nginx as a Reverse Proxy for Icecast

Next, you will need to install and configure Nginx as a reverse proxy to access Icecast.

First, install the Nginx server with the following command:

apt-get install nginx -y

Once installed, create an Nginx virtual host configuration file:

nano /etc/nginx/sites-available/icecast.conf

Add the following lines:

server {
listen 80;
listen [::]:80;
server_name icecast.example.com;
access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log;
location / { proxy_pass http://localhost:8000; } }

Save and close the file, then enable the virtual host with the following command:

ln -s /etc/nginx/sites-available/icecast.conf /etc/nginx/sites-enabled/

Next, you will also need to set hash bucket size in Nginx main configuration file:

nano /etc/nginx/nginx.conf

Add the following line inside http {:

server_names_hash_bucket_size 64;

Save and close the file, then restart the Nginx service to apply the changes:

systemctl restart nginx

Thank you!

Chris

Thank you! That solved the 421 Misdirection problem.

Any idea on how to install Icecast2 and point it to one of my domains?

How is this related?
Here are questions regarding hestiacp
icecast has nothing to do with the control panel.

Try looking up various searches here: how to install Icecast2 (web)

Agreed it is not related, but forums help out in various ways and manners. Another thing, irrespective of the nature, it is good to keep our conduct nice towards everyone. Better way to put it would be:
“suggest you reach out to the icecast forums, and they should be able to guide you better.”

I am as friendly as possible)
The question is not related to the panel

I thought it is related since I try to setup an Icecast2 website using Hestia. The installation of Hestia changes the apache2 and nginx default configurations, hence I have trouble with setting up the Icecast2 site.

If it is not related, my apologies. I really appreciate your help!

1 Like

Change the port in icecast to another and open in hestia firewall

1 Like

Thank you. I tried that and didn’t work.

I checked the conf file at /home/user/conf/web/site.com/nginx.conf and there is a warning not to modify the file. I think I need to change the Hestia template file. Not sure if that is correct and how to do that. I think I need to add this nginx conf to the right file:

server
{
	listen 80;
	listen [::]:80;
	server_name onlineradio.example.com;

	proxy_set_header Host $host;
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header X-Forwarded-Host $host;
	proxy_set_header X-Forwarded-Server $host;

	location /
	{
		proxy_set_header Accept-Encoding "";
		proxy_pass http://127.0.0.1:8000/;
		sub_filter_types application/xspf+xml audio/x-mpegurl audio/x-vclt text/css text/html text/xml;
		sub_filter ':8000/' '/';
		sub_filter '@localhost' '@onlineradio.example.com';
		sub_filter 'localhost' $host;
		sub_filter 'Mount Point ' $host;
	}
}

Unfortunately, this is beyond the capabilities of the panel and is considered custom configs.
I am a system administrator and personally provide services for setting up servers on a paid basis.
But I do not think it is appropriate to offer my services here so as not to offend other community members.
Any setting with the addition of your parameters you do everything at your own peril and risk.

1 Like

You can create a separate template and use it. That is feasible as well. See this thread, and similar ones here in the forum: Http3 Nginx temnplates directives - #4 by sahsanu

1 Like

OK understood, Thank you so much for your kind help! I really appreciate it.

1 Like

OK, I got it to work. Here is the solution:

First create copies the default templates naming them to “icecast” :

sudo cp /usr/local/hestia/data/templates/web/nginx/default.tpl /usr/local/hestia/data/templates/web/nginx/icecast.tpl

sudo cp /usr/local/hestia/data/templates/web/nginx/default.stpl /usr/local/hestia/data/templates/web/nginx/icecast.stpl

Edit the new icecast.stpl. After the end of the following:

location / {
                proxy_ssl_server_name on;
                proxy_ssl_name $host;
                proxy_pass https://%ip%:%web_ssl_port%;

                location ~* ^.+\.(%proxy_extensions%)$ {
                        try_files  $uri @fallback;

                        root       %sdocroot%;
                        access_log /var/log/%web_system%/domains/%domain%.log combined;
                        access_log /var/log/%web_system%/domains/%domain%.bytes bytes;

                        expires    max;
                }
        }

Add the below:

location = /radio {
                return 302 /radio/;
        }
location /radio/ {
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Host $host;
                proxy_set_header X-Forwarded-Server $host;

                proxy_set_header Accept-Encoding "";
                proxy_pass http://%ip%:8000/;
                sub_filter_types application/xspf+xml audio/x-mpegurl audio/x-vclt text/css text/html text/xml;
                sub_filter ':8000/' '/';
                sub_filter '@localhost' '@mydomain.com';
                sub_filter 'localhost' $host;
                sub_filter 'Mount Point ' $host;
}

Save the template and then head to the Hestia Control Panel. Select the domain you want to modify and click the pencil icon to edit it.

Click on the “Advanced Options” button, scroll down to the “Proxy Template” dropdown and select “icecast”. Finally click “Save”.

Make sure icecast is running on your server. Browse to your domain https://mydomain.com/radio. You should be able to see the Icecast Status page.

Done!

1 Like