All posts filed under: System Administration

Nginx configuration for Django

Leave a comment
Howtos / System Administration

Django is a powerful framework for building websites. To run a production website, usually an application server is used. So nginx will do two basic things: Serve your Django application from the application server port to the web port (Reverse Proxy) Serve static and media files The application server used in this example is gunicorn, the application server chosen by Instagram of the earlier days, but it can be anything running on port 9999. Change […]

nginx: [emerg] open() “/usr/share/nginx/off” failed (13: Permission denied) [SOLVED]

Leave a comment
Howtos / System Administration

After a failed restart of the nginx server, you can get this error typing journalctl -xe: nginx: [emerg] open() “/usr/share/nginx/off” failed (13: Permission denied) [SOLVED] This is caused by a misconfiguration of nginx.conf or a conf inside the /etc/nginx/conf.d/ directory where there’s something like: This is the wrong way to disable logs. Nginx is actually trying to write a file called off inside the default folder. The right way To disable error_log simply do not […]

Use external mail server for mdadm

Leave a comment
Howtos / System Administration

mdadm is the utility to check and report failures on RAID disks. The usual way this Linux application send its message is a plain old e-mail. In this howto you’ll find the instruction to use an external mail server with mdadm. First, replace sendmail with an external email account. After you’ve configured and tested msmtp you’re ready to configure mdadm. Configure mdadm with the new SMTP Change /etc/mdadm/mdadm.conf to Where: senderaddress@example.com is your FROM e-mail, […]

Use external SMTP server for system mails on Linux

Leave a comment
Howtos / System Administration

To use an external SMTP for all system e-mails, you have to install these: Where msmtp-mta transform the external reference in the sendmail command usable by any application using sendmail. In this way you haven’t to install and configure Postfix since you’ll rely on an external SMTP service. Create the config file for msmtp This is an example based on the popular Gmail by Google: Replace these with the real data from your e-mail account. […]

Automate log cleanup for GDPR: the Sentry case

Leave a comment
Howtos / System Administration

With the General Data Protection Regulation (GDPR) enforced by European Union logs have to be cleaned regularly to delete IP addresses and other information about visitors. This can be interpreted as a way to protect an emerging and discussed right, the right to be forgotten. This new regulation is impacting every automated log system out of there. Since Sentry is a good open source error monitoring software* and it’s widely used, this guide will show […]

Cannot connect to wired connection on Ubuntu (SOLVED)

Leave a comment
Howtos / System Administration

When your Wireless interface is working and the ethernet isn’t working on Ubuntu, here’s a quick howto to check and fix a misconfiguration. It doesn’t solve any ethernet issues but you can give a try and on an Asus laptop (with JMicron chipset) I worked on it makes the job done. Tested on Ubuntu 16.04 LTS First steps To detect Ethernet interface: To check and configure connection: To save the current status of network interface: […]

Failed to start Authorization manager (SOLVED)

Leave a comment
Howtos / System Administration

If you get the “Failed to start Authorization manager” while booting a Linux OS (e.g. CentOS) most likely you’ve a SELinux misconfiguration. The main issue is that if you’ve restarted the system, you cannot login since OpenSSH service is not running. If you’ve a virtual server, even the console shipped by your provider is stuck on the Authorization manager error. The reason behind this in my case was a completely wrong value in SELINUXTYPE. The […]

Certbot: auto-renew LetsEncrypt certificate on cron

Leave a comment
Howtos / System Administration

Certificates renewal can be difficult to automate leading to errors that will mark the website as “Insecure”. Here’s how to automate certificate renewal on CentOS 7 with nginx as webserver: And then add to the crontab these lines pressing A to edit: Every day at 02.37 the certificate will be asked for renewal. Two minutes later nginx will be restarted. After you’ve typed these lines, type: :wq To write and quit. You’ll get this message: […]

Linux: MySQLdb on virtualenv with –no-site-packages

comment 1
Howtos / Python / System Administration

In the past it was difficult to get MySQL working on virtualenv without using system packages. Now you can have a real separated environment with simple steps: Follow this guide to install virtualenv using this command: This command will install a new virtualenv inside a new directory myproject created by the command itself. Activate virtualenv: Upgrade setuptools You can now install MySQLdb, inside the package MySQL-python: Now do a simple test trying to connect to […]