Note |
---|
These are instructions for flex.bi private 4.0 and later |
...
- Go to the /etc/nginx/conf.d on your server.
- Create a new file in this directory and name it accordingly, for example, flexbi.conf.
Use your preferred text editor to insert the following configuration information into the newly created configuration file:
Code Block server { listen 80; server_name example.com; root /home/flexbi/flexbi_private/public/flexbi; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_set_header Cookie "$http_cookie;nginxremoteaddr=$remote_addr"; proxy_set_header X_FORWARDED_PROTO $scheme; proxy_pass http://127.0.0.1:8080; proxy_cache_valid 200 302 60m; } access_log /var/log/nginx/nginx.vhost.access.log; error_log /var/log/nginx/nginx.vhost.error.log; }
Note In the configuration above, replace example.com with your domain name which has a hostname configured for this server in DNS records.
Run the following command to reload nginx and apply the new configuration:
Code Block sudo systemctl reload nginx
Note To test if everything is working, open your website in a web browser using http:// (e.g. https://example.com).
Obtain a Certificate
You can use Certbot to obtain SSL certificates using various plugins. We will use nginx plugin which takes care of reconfiguring nginx and reloading the configuration whenever necessary.
Run the following command to obtain a certificate for your domain:
Code Block |
---|
sudo certbot --nginx -d example.com |
...
Note |
---|
To test if everything is working, open your website in a web browser using https:// (e.g. https://example.com). The site should open with a secure connection indicator (a lock icon) next to the address. |
Set-up Certificate Auto Renewal
Let's Encrypt's certificates are only valid for ninety days. We will use cron, a standard system service for running periodic jobs, to periodically check the certificate and renew it, if it is necessary.
...
Note |
---|
The 15 3 * * * part of this line means that the following command will run at 3:15 am every day. You can choose any time. |
Reconfigure flex.bi For HTTPS schema
Now, when you have access to your server through https schema, you have to configure flex.bi to use your domain name and https. To achieve this, you have to configure the file eazybi.toml which is located in the directory /home/flexbi/flexbi_private/config of your server.
- Run the following command to open the file for editing (in this example we are using vi text editor):
Code Block |
---|
vi /home/flexbi/flexbi_private/config/eazybi.toml |
Note |
---|
In the code example above we are using the vi text editor, but you can use the editor of your choice. |
- In the opened file find the part [default_url_options]. It should look similar to this:
Code Block |
---|
[default_url_options] # This example is for the default http://localhost:8080 URL. host = "<your-ip-address>" port = 8080 # This example is for the https://example.com URL. # host = "example.com" # protocol = "https" |
Note |
---|
In the code example above you should see the IP address of your server instead of <your-ip-address>. |
- Edit the part [default_url_options] following this example:
Code Block |
---|
[default_url_options]
# This example is for the default http://localhost:8080 URL.
# host = "<your-ip-address>"
# port = 8080
# This example is for the https://example.com URL.
host = "example.com"
protocol = "https" |
Note |
---|
In the code example above enter your domain name instead of example.com. |
Run the following command to restart flex.bi:
Code Block systemctl restart flexbi
Congratulations, your server is set up and ready to go!