Back to home page

4get guide

Table of Contents

1. About 4get

4get is a meta search engine similar to searxng. Its faster, less resource intense, and more reliable than searxng. This guide is made for peeps using 4get with lighttpd+freebsd. Those using a more sane setup should just check out the 4getdocs.

2. Installing 4get

First install a few packages. Replace 84 with whatever php version your using.

pkg install lighttpd curl git php84 php84-curl php84-fileinfo php84-filter \
php84-mbstring php84-pecl-APCu php84-pecl-imagick php84-sodium php84-zlib

Next cd into /usr/local/www or wherever you keep your website data and clone the repo with git clone --depth 1 https://git.lolcat.ca/lolcat/4get <whatever the fuck you want>

Now that you have it downloaded check out data/config.php and change it to your liking. It's not my job to tell you how you want your 4get instance configured (:

3. Setting up lighttpd

If your reading this you likely already used lighttpd since there is no other reason you would pick lighttpd out of all the other web servers rofl. Well anyways here is a basic config for 4get to get you started.

server.modules += ("mod_rewrite", "mod_fastcgi", "mod_access")
server.name = "<whatever the fuck you want>"
server.document-root = "/usr/local/www/<whatever the fuck you want>"
server.pid-file = "/var/run/lighttpd.pid"
index-file.names = ("index.php")
fastcgi.server = (
".php" => (
"localhost" => (
"socket" => "/var/run/php/php-fpm.sock",
"broken-scriptfilename" => "enable"
))
)
$HTTP["url"] =~ "^/data" {
url.access-deny = ("")
}
url.rewrite-once = ( "^(.*)/$" => "$1/" )
url.rewrite-if-not-file = ( "^([^?]*)(\?.*)?$" => "$1.php$2" )

Next run mkdir /var/run/php and chown www:www /var/run/php to create the directory for the sock

To configure the sock path open /usr/local/etc/php-fpm.d/www.conf and set this value somewhere:

listen = /var/run/php/php-fpm.sock

To prevent those annoying php warnings from showing up put these in /usr/local/etc/php.ini

error_reporting = E_ALL &amp; ~E_DEPRECATED
display_errors = On

To enable and start it run:

service php_fpm enable
service lighttpd enable
service php_fpm start
service lighttpd start


4. Tor proxy

Using a proxy is likely something you will want to do. Meta search engines tend to get IP banned and all of that funky stuff.

4.1. torrc

To use tor as your proxy add these lines to /usr/local/etc/tor/torrc

SOCKSPort 127.0.0.1:9050
DNSPort 53
AutomapHostsOnResolve 1

The reason to also use torDNS is that if you don't you will get DNS leaks.

4.2. Tor service

For tor to be able to create a DNS server in freebsd add this to /etc/rc.conf

tor_setuid="YES"

To use tor DNS change the content of /etc/resolv.conf to nameserver 127.0.0.1

Run service tor enable and service tor start to get it going

To config 4get to use tor edit <4get directory>/data/config.php and set all the const PROXY_<...> to "onion"

...
const PROXY_DDG = "onion"; // duckduckgo
const PROXY_BRAVE = "onion";
const PROXY_FB = "onion"; // facebook
...

4.3. Freebsd pkg issue

Freebsd pkg doesn't like torDNS. To fix that run mkdir -p /usr/local/etc/pkg/repos then cp /etc/pkg/FreeBSD.conf /usr/local/etc/pkg/repos/

Now change /usr/local/etc/pkg/repos/FreeBSD.conf to something like this:

FreeBSD: {
url: "https://pkg.FreeBSD.org/${ABI}/quarterly",
mirror_type: "none",
signature_type: "fingerprints",
fingerprints: "/usr/share/keys/pkg",
enabled: yes
}

NSW