Setting up Nginx For Searx in freeBSD

This blog post was written by a freeBSD noob. I just wrote how I did it, which might not be the most efficient way possible :)

Installing packages

Install nginx

Install nginx with

sudo pkg install nginx

Install certbot

sudo pkg install #TODO


configure nginx

Add nginx to rc.conf


and enable it

sudo service nginx start

Create a sites-enabled directory

sudo mkdir /usr/local/etc/nginx/sites-enabled

Create a conf file for searx

sudo touch /usr/local/etc/nginx/sites-enabled/searx.conf

Then we need to edit nginx.conf this way we are going to have the search engine in a subdomoin (for example

This file is going to be the homepage (in my example

worker_processes  1;

events {
    worker_connections  1024;

http {
    include       mime.types;
    default_type  application/octet-stream;
    include /usr/local/etc/nginx/sites-enabled/*;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       80;
        server_name  YOUR-DOMAIN.COM;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;
        location / {
            root   /usr/local/www/nginx;
            index  index.html index.htm;

Now for the searx.conf

server {
    listen 80;
    listen [::]:80;

    access_log /dev/null;
    error_log  /dev/null;

    root /var/www/;
    index index.html index.htm index.nginx-debian.html;


    location / {

        proxy_pass http://localhost:8888; #port for searx
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

Restarting nginx server

sudo service nginx restart

SSL certificate (https)

now you should see your website running in, which is insecure, so we should upgrade to https with a SSL certificate from certbot.

there is guide for that here: How to use certbot in freeBSD with nginx