Skip to content

Instantly share code, notes, and snippets.

@odoral
Last active October 12, 2020 11:08
Show Gist options
  • Save odoral/17d184ffa2246fbdcd08e4d67f48d411 to your computer and use it in GitHub Desktop.
Save odoral/17d184ffa2246fbdcd08e4d67f48d411 to your computer and use it in GitHub Desktop.
openmediavault + pihole

OMV (/etc/nginx/sites-enabled/openmediavault-webgui):

OMV default configuration is consuming all /**/*.php requests. We've to exclude /pihole php requests to forward them to pihole.

location ~ ^(?!\/pihole\/).*\.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/run/php/php7.3-fpm-openmediavault-webgui.sock;
    fastcgi_index index.php;
    fastcgi_read_timeout 60s;
    include fastcgi.conf;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

pihole proxy pass (/etc/nginx/sites-custom/pihole.conf)

location /pihole/ {
	proxy_pass http://127.0.0.1:8080/admin/;
	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_read_timeout 90;
}

Wiring pihole nginx configuration

We're going to include custom sites configuration at the end of server{} definition.

server{
...
    include /etc/nginx/sites-custom/*.conf;
}```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment