I installed Metabase as a service on the server and I have it booted but I have a problem in the Nginx configuration. I am using Laravel Forge for the project and I need to change the Nginx configuration to be able to access Metabase.
My current default configuration file is the following:
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/default/before/*;
server {
listen 80;
listen [::]:80;
server_name x.x.x.x;
server_tokens off;
root /home/forge/default/public;
# FORGE SSL (DO NOT REMOVE!)
# ssl_certificate;
# ssl_certificate_key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
ssl_dhparam /etc/nginx/dhparams.pem;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/default/server/*;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/default-error.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/default/after/*;
According to metabase docs, adding the following statement i should be able to access the metabase:
# sample nginx.conf
# proxy requests to Metabase instance
server {
listen 80;
listen [::]:80;
server_name your.domain.com;
location / {
proxy_pass http://127.0.0.1:3000;
}
}
When I add the proxy_pass with the configuration as follows, the server fails: it returns a 502 Bad Gateway error and a connection time out when I try to access port 3000.
location / {
try_files $uri $uri/ /index.php?$query_string;
proxy_pass http://127.0.0.1:3000;
}
What should I change in the nginx configuration to be able to access metabase? Any help would be appreciated
For other people who don't know about systems, I had the port blocked.
To see if you have port 3000 open, use
.
If it does not appear, open the port with
That's it, now it's working