How to Install Ajenti with Nginx and SSL on FreeBSD 10.2

Ajenti is open source web based system management tools, control panel for your server based on python. Support for many distro like Ubuntu, CentOS, Debian and Unix FreeBSD. Ajenti coded with python, it is lightweight control panel with beautiful interface. It is allow you to manage your services on your server, manage apache, cron jobs, firewall, mysql database etc. Ajenti is powerfull and easy to install.

In this tutorial we will guide you to install ajenti with nginx as the web server, and then configure SSL for ajenti on freebsd 10.2. we will guide you to install ajenti from pip (Package management in python), install all package needed by ajenti from freebsd ports, and then install and configure nginx to running in front of ajenti with SSL enabled.


  • FreeBSD 10.2 - 64bit.
  • Root Privileges.

Step 1 - Update FreeBSD Ports

Log in to your freebsd server and update the repository :

freebsd-update fetch
freebsd-update install

Step 2 - Install Package needed

In this step we will install all package that needed by ajenti. We will install all of it from the freebsd ports. Just go to the ports directory "/usr/ports/", then choose the package, compile and install it.

Ajenti need py-gevent, so go to the directory of py-gevent :

cd /usr/ports/devel/py-gevent

then install it with command :

make install clean

install : Compile and install the ports.

clean : Remove the work directory and other temporary files used for building the ports.

Next, Install all of this ports just like install py-gevents above.

# Install py-lxml
cd /usr/ports/devel/py-lxml
make install clean

# Install Pyhton pip
cd /usr/ports/devel/py-pip
make install clean

# Install py-ldap module
cd /usr/ports/net/py-ldap
make install clean

# Install jpeg module that needed by Pillow python imaging library.
cd /usr/ports/graphics/jpeg
make install clean

Wait all of it.

Step 3 - Install Ajenti

On linux distribution like ubuntu and centos, we can install ajenti from the repository. But in this tutorial FreeBSD 10.2, we will install ajenti from the pip command. Pip is a package management system used to install and manage software packages written in Python.

So let's install :

pip install ajenti

Now configure it.

Step 4 - Configure Ajenti

Download ajenti service script from github to "/etc/rc.d/" directory with wget command :

wget --no-check-certificate -O /etc/rc.d/ajenti

Next, change the permission of the service file :

chmod +x /etc/rc.d/ajenti

Service script for ajenti is configured, so let's download the configuration file for ajenti. Before we download it, we need to make a symlink for python binary command :

ln -s /usr/local/bin/python2 /usr/bin/python

And create new directory for ajenti configuration file :

mkdir -p /usr/local/etc/ajenti/
mkdir -p /etc/ajenti/

Next, download the configuration file to directory "/usr/local/etc/ajenti/", and create a symlink for config file to directory "/etc/ajenti/" :

wget --no-check-certificate -O /usr/local/etc/ajenti/config.json
ln -s /usr/local/etc/ajenti/config.json /etc/ajenti/config.json

Then edit the config file with nano editor :

nano -c /etc/ajenti/config.json

On the line 35, change the value to "true".

"authentication": true,

Save and exit.

If all is done, add ajenti to run at boot time with sysrc command, and then start it :

sysrc ajenti_enable=yes
service ajenti start

Visit your server IP on port 8000,

Ajenti Home Page

Step 5 - Generate Self Signed SSL Certificate

In this step we will generate new self signed SSL certificate. Go to "/usr/local/etc/" directory and make new directory called "ssl".

cd /usr/local/etc/
mkdir ssl
cd /usr/local/etc/ssl

Now generate the self signed SSL certificate file with single openssl command :

openssl req -new -x509 -nodes -out ajenti.crt -keyout ajenti.key

Now change the permission of the private key :

chmod 600 ajenti.key

SSL Generated on directory "/usr/local/etc/ssl/".

Step 6 - Install and Configure Nginx

In this tutorial we will use nginx as reverse proxy for ajenti that running on port 8000. Install nginx from the freebsd repository with pkg command :

pkg install nginx

Next, Configure the virtualhost for ajenti.

Go to nginx directory and create new directory for virtualhost called "vhost" :

cd /usr/local/etc/nginx/
mkdir vhost

Go to vhost directory and create new file ajenti.conf with nano editor :

cd /usr/local/etc/nginx/vhost
nano -c ajenti.conf

Paste nginx virtualhost configuration below :

server {

# Domain
client_max_body_size 20m;

# Nginx listening on port 80 and 443
listen 80;
listen [::]:80;
listen 443 default ssl;

# SSL Certificate File
ssl_certificate      /usr/local/etc/ssl/ajenti.crt;
ssl_certificate_key  /usr/local/etc/ssl/ajenti.key;

# Redirect HTTP to HTTPS
if ($scheme = http) {
return 301 https://$server_name$request_uri;

# Proxy pass configuration for ajenti
location ~ /ajenti.* {
rewrite (/ajenti)$ / break;
rewrite /ajenti/(.*) /$1 break;
proxy_redirect / /ajenti/;
proxy_set_header Host $host;
proxy_set_header Origin http://$host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;


Save and exit.

Now activate the nginx virtualhost by editing the main configuration file nginx.conf on nginx directory :

cd /usr/local/etc/nginx/
nano -c nginx.conf

Add before the end of the line below :

 includ vhost/*.conf

Save and exit.

Now add nginx to the boot time, then start it and restart ajenti :

sysrc nginx_enable=yes
service nginx start
service ajenti restart

Visit your domian :

ajenti with nginx and ssl

Log in to ajento with the default account username "root" and password "admin".

Ajenti Dashbord.

Ajenti Dashbord

List of Ajenti Plugins.

Ajenti Plugins

Service page to manage the service on the server.

Ajenti Service page

Ajenti with nginx and SSL is installed on FreeBSD 10.2.


Ajenti is web based system management tools based on python. It is lightweight and powerful, we can manage the service of the server from the admin web. Available on Linux and Unix distribution including FreeBSD. We can start and stop the service from the web page. Ajenti run on port 8000, and we can use Nginx or apache as the reverse proxy for ajenti with SSL enabled on the front end web server(Nginx or Apache). It is easy to install and configure an have a beautiful Interface.

5 Comments... add one

  1. Hi,

    Thank you for this great tutorial.
    I manged to get everything working except the url, I get
    This webpage is not available


    I can see the page when I go to myip:8000

    I copied and past everything and had to change:
    includ vhost/*.conf
    include vhost/*.conf;

  2. 1) py-gevent not need to install, ajenti automatic install!
    2) nginx: need create folders conf.d in /usr/local/etc/nginx
    3) ajenti: config.json need check mysql login/pass
    4) check /etc/rc for path


Leave a Comment