GoatCounter is an open-source web analytics software that keeps track of website traffic in real-time. This guide will walk you through the steps to install GoatCounter on a Debian latest system.
Before installing GoatCounter, you need to install the following dependencies on your Debian server:
sudo apt-get update
sudo apt-get install -y libpq-dev postgresql wget curl
Go to the GoatCounter download page and copy the download link for your Debian architecture. Then, run the following command to download and extract GoatCounter:
wget https://github.com/goatcounter/goatcounter/releases/download/v1.3.1/goatcounter-v1.3.1-linux-amd64.tar.gz
tar xvf goatcounter-v1.3.1-linux-amd64.tar.gz
Next, navigate to the extracted folder and create a configuration file:
cd goatcounter-v1.3.1-linux-amd64
cp example.site.conf site.conf
Edit the site.conf
file with your PostgreSQL database credentials:
goatcounter_db = "postgresql://user:password@localhost:port/dbname"
You can also customize other settings, such as the website domain and name.
To start GoatCounter, run the following command:
./goatcounter run
By default, GoatCounter listens on port 8080. You can access GoatCounter by navigating to your server’s IP address or domain name followed by :8080
.
To use HTTPS, you need to configure a reverse proxy for GoatCounter. For example, you can use Nginx or Apache. Here’s an example of how to configure Nginx for HTTPS:
Install Nginx:
sudo apt-get install -y nginx
Create an Nginx server block for GoatCounter:
sudo nano /etc/nginx/sites-available/goatcounter
Add the following configuration:
server {
listen 80;
server_name domain.com;
location / {
return 301 https://$server_name$request_uri;
}
}
server {
listen 443 ssl;
server_name domain.com;
ssl_certificate /path/to/ssl/cert;
ssl_certificate_key /path/to/ssl/key;
location / {
proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_redirect off;
# ... other proxy settings
}
}
domain.com
, /path/to/ssl/cert
, and /path/to/ssl/key
with your domain name and SSL certificate file paths.proxy_pass
directive sets the reverse proxy destination to localhost:8080
, where GoatCounter is listening.Enable the GoatCounter server block:
sudo ln -s /etc/nginx/sites-available/goatcounter /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
You can now access GoatCounter over HTTPS by navigating to your domain name.
Congratulations, you have successfully installed and configured GoatCounter on Debian latest.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!