Category Archives: Linux

Discourse – email and Job exception: Net::ReadTimeout

 

Email

For a Discourse instance to function properly Email must be set up. Use the SMTP_URL env var to set your SMTP address, see sample templates for an example. The Docker image does not contain postfix, exim or another MTA, it was omitted because it is very tricky to set up correctly.

Source: https://github.com/discourse/discourse_docker

Yah! Discourse doesn’t came with any MTA (mail transfer agent).
I had to install Postfix so that Discourse could send out emails.

My emails weren’t getting delivered…
I was getting the following error on discourse logs(/var/discourse/shared/standalone/log/rails/production.log)….

Job exception: Net::ReadTimeout

After a few tweaks… I got it working…
This is my /var/discourse/containers/app.yml excerpt….

## TODO: List of comma delimited emails that will be made admin and developer
 ## on initial signup example '[email protected],[email protected]'
 DISCOURSE_DEVELOPER_EMAILS: '[email protected]'

## TODO: The SMTP mail server used to validate new accounts and send notifications
 DISCOURSE_SMTP_ADDRESS: mail.domain.com
 DISCOURSE_SMTP_PORT: 25
 DISCOURSE_SMTP_USER_NAME: [email protected]
 DISCOURSE_SMTP_PASSWORD: XXXXXXX
 DISCOURSE_SMTP_ENABLE_START_TLS: false
Rebuild the APP
cd /var/discourse/
./launcher rebuild app
Readings

 

bad ownership or modes for chroot directory component

 

Jul 14 11:41:18 sd-47XXX systemd-logind[643]: New session 26596 of user wojcatie.
Jul 14 11:41:18 sd-47XXX systemd: pam_unix(systemd-user:session): session opened for user wojcatie by (uid=0)
Jul 14 11:41:18 sd-47XXX sshd[8455]: fatal: bad ownership or modes for chroot directory component "/home/httpd/html/domain.com/"
Jul 14 11:41:18 sd-47XXX sshd[8430]: pam_unix(sshd:session): session closed for user wojcatie
Jul 14 11:41:18 sd-47XXX systemd-logind[643]: Removed session 26596.

/home/httpd/html/domain.com/ has to be owned by root:root and chmod with 755.

sudo chown root:root /home/httpd/html/domain.com/
sudo chmod 755/home/httpd/html/domain.com/

 

Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

This new server with Ubuntu 16.04 LTS cames with PHP 7.0.

The backup that I have from my client has some old WordPress blogs…

Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

I need to downgrade PHP 7.0 to PHP 5.6, at least for now.

Before you procede with the tutorial on the following link, and if you are running a new Ubuntu 16 installation you might get upon the following error while following the tutorial.

root@sd-4XXXX:/home/httpd/html# sudo add-apt-repository ppa:ondrej/php
sudo: add-apt-repository: command not found

To install add-apt-repository you will need to run the following command

sudo apt-get install software-properties-common

Now the solution  How can I downgrade from PHP 7 to PHP 5.6 on Ubuntu 16.04? [duplicate].

 

Ubuntu 16.04 LTS tutorials

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 16.04
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04

How to secure an Ubuntu 16.04 LTS server

https://www.thefanclub.co.za/how-to/how-secure-ubuntu-1604-lts-server-part-1-basics

The Perfect Server – Ubuntu 16.04 (Xenial Xerus) with Apache, PHP, MySQL, PureFTPD, BIND, Postfix, Dovecot and ISPConfig 3.1

https://www.howtoforge.com/tutorial/perfect-server-ubuntu-16.04-with-apache-php-myqsl-pureftpd-bind-postfix-doveot-and-ispconfig/

How To Protect WordPress with Fail2Ban on Ubuntu 14.04

https://www.digitalocean.com/community/tutorials/how-to-protect-wordpress-with-fail2ban-on-ubuntu-14-04

UFW Essentials: Common Firewall Rules and Commands

https://www.digitalocean.com/community/tutorials/ufw-essentials-common-firewall-rules-and-commands

Other readings…

Potential ufw and fail2ban conflicts

http://askubuntu.com/questions/54771/potential-ufw-and-fail2ban-conflicts

 

Apache / PHP – End of script output before headers

 

[Thu May 12 03:14:41.562083 2016] [core:error] [pid 25726] [client 68.71.XXX.XXX:44611] End of script output before headers: manage.php
[Thu May 12 03:14:41.697026 2016] [:error] [pid 26855] [client 84.91.XXX.XXX:60222] SoftException in Application.cpp:256: File “/home/rocker/public_html/system/manage.php” is writeable by group

I had to set the file to 755.

As seen on http://stackoverflow.com/questions/17583341/error-500-premature-end-of-script-headers

fatal: no matching comp found: client zlib server none,[email protected]

 

May  4 00:04:35 sd-71796 sshd[20887]: fatal: no matching comp found: client zlib server none,[email protected] [preauth]

You need to install zlib and libgcrypt11-dev and set compression to yes on /etc/ssh/sshd_config.

sudo apt-get install libgcrypt11-dev zlib1g-dev

Then

sudo nano /etc/ssh/sshd_config

And add Compression yes to it.
Save and restart ssh.

sudo service ssh restart

In some cases you might need to restart the server.