How to reveal Real IP Cloudflare using Ubuntu 18.04

Mod_cloudflare has a few software dependencies that need to be installed first:

# yum install libtool httpd-devel

Next, you should download the mod_cloudflare source to your server:

# wget https://raw.githubusercontent.com/cloudflare/mod_cloudflare/master/mod_cloudflare.c

Finally, install the module. Depending on your system, the command to run might be apxs or apxs2. So, run one of the below two commands. If you get a ‘Command not found’ when running one, try the other:

# apxs -a -i -c mod_cloudflare.c
# apxs2 -a -i -c mod_cloudflare.c

Source : https://www.cloudflare.com/technical-resources/#mod_cloudflare

NextCloud : How to fix Strict Transport Security (HSTS) and Memory Cache

Hello,

Do you use NextCloud and see bellow notification?

No memory cache has been configured and The “Strict Transport Security” HTTP header is not configured warning messages.


Here is how to fix HSTS issue

1. Open you domain configuration on Apache add this following line after ServerName

Header always add Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"

2. Enable module header

a2enmod headers

3. Restart the apache

sudo service apache2 restart


Here is how to fix Memory Cache

1. Install php-apcu

apt-get install php-apcu php-apcu-bc

2. Navigate and edit NextCloud config, add this following config

'memcache.local' => '\OC\Memcache\APCu',

3. Save and restart apache

sudo service apache2 restart

All notification should be gone now. Have fun..
Thank you.

How to disable Windows Defender using the Registry

Windows 10 offers an option to disable Windows Defender, but it’s a temporary option when you probably are looking for a more permanent solution.
1. Use the Windows key + R keyboard shortcut to open the Run command, type regedit, and click OK to open the registry.
2. Browse the following path:

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender

3. If you don’t see DWORD DisableAntiSpyware, right-click on an empty space, select New, and click on DWORD (32-bit) Value.
4. Name the key DisableAntiSpyware.
5. Double-click the newly created key, and set the value from 0 to 1.
6. Restart your computer to complete the task.

Thats it… and you have disable Windows Defender permanently.

How To Enable PHP-FPM on Ubuntu 14.04

We can use php-fpm on Apache to boost performance. Please follow this step to enable.
Install and activate apache2-mpm-event by running the following commands:

sudo apt-get update
sudo apt-get install apache2-mpm-event

To use PHP5-FPM with Apache, we need to install libapache2-mod-fastcgi module. The libapache2-mod-fastcgi module is not available in the Ubuntu package. Therefore, we need to update the apt sources. Follow these steps.

sudo nano /etc/apt/sources.list

Add the following lines at the end of the file:

deb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse

Install libapache2-mod-fastcgi:

sudo apt-get update
sudo apt-get install libapache2-mod-fastcgi

Install PHP5-FPM with the following command:

sudo apt-get install php5-fpm

Create the PHP5-FPM configuration file for Apache:
sudo nano /etc/apache2/conf-available/php5-fpm.conf

then add the following lines:
<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization
<Directory /usr/lib/cgi-bin>
Require all granted
</Directory>
</IfModule>

Enable the new modules and configuration for Apache:

sudo a2enmod actions fastcgi alias
sudo a2enconf php5-fpm

Also enable mod_proxy and mod_proxy_fcgi apache modules

Thank you

How To Add Public key on Ubuntu

Hello,

Sometimes we can see an error from Ubuntu in regards of missing public key.
==============================
The following signatures couldn’t be verified because the public key is not available
==============================

We can fix this error by adding the key using following command

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C

Please replace the key the same with the error from the Ubuntu. Hope this simple method can fix the error.
Thank you..

How To Disable IPv6 in Ubuntu VPS

Hello,

We can disable IPv6 in Ubuntu VPS. This time the Ubuntu version is 14.04 LTS.

To disable ipv6, you have to open /etc/sysctl.conf using any text editor and insert the following lines at the end:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Or we can disable from boot by editing the GRUB config

sudo gedit /etc/default/grub

In this file, find this line:
>> GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”

and change it to:
>> GRUB_CMDLINE_LINUX_DEFAULT=”ipv6.disable=1 quiet splash”

Save the file and update grub by running:

sudo update-grub

Have fun…

Source : http://askubuntu.com/questions/440649/how-to-disable-ipv6-in-ubuntu-14-04

How To Fix Odoo PostgreSQL UTF-8 Encoding

Hello,

To fix this error, please run this following code

sudo -u postgres psql postgres

and then run this code

update pg_database set datallowconn = TRUE where datname = 'template0';
\c template0
update pg_database set datistemplate = FALSE where datname = 'template1';
drop database template1;
create database template1 with template = template0 encoding = 'UTF8';
update pg_database set datistemplate = TRUE where datname = 'template1';
\c template1
update pg_database set datallowconn = FALSE where datname = 'template0';

To exit from postgre console, please press Ctrl-D

Ref : Odoo Forum

How To Disable PosBox Status Print

Hello,

The posbox status I mean the IP address and Homepage infiormation that printed automatically everytime we turn on the posbox. We can disable this print.

Comment it out and put in a pass statement (in bold below):
(excerpt from file on the posbox: /home/pi/odoo/addons/hw_escpos/controllers/main.py -Line 177 has call to comment)
Make sure to indent the pass with 4 spaces to align with old function call position.

elif task == 'xml_receipt':
    if timestamp >= time.time() - 1 * 60 * 60:
        printer.receipt(data)
elif task == 'cashbox':
    if timestamp >= time.time() - 12:
        self.open_cashbox(printer)
elif task == 'printstatus':
    #self.print_status(printer)
    pass
elif task == 'status':
    pass
error = False 

That’s all. Now the posbox won’t print the status on each boot-up.
Thank you

How To Use Apache as Reverse Proxy on Odoo

Hello,

Odoo currently is very wellknown ERP that everybody can use it freely. On default Odoo use port 8069 (ex www.example.com:8069) to access the application. But we can remove those port by using Apache as a reverse proxy. This tutorial consider that Odoo has been installed on the server.

Install Apache2 and enable some modules

sudo apt-get install apache2
sudo a2enmod proxy_http headers rewrite

Create self-signed certificate (optional)

openssl genrsa -out privkey.pem 2048
openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095

Copy created file to the SSL directory => /etc/ssl/odoo/

Create a new apache2 configuration file

sudo nano /etc/apache2/site-available/odoo.example.com <== please change this as your own address

Fill the file with this code (NO SSL)

    
        ServerName domain.com // <== CHANGE THIS VALUE
        ServerAlias *.domain.com // <== CHANGE THIS VALUE
        ErrorLog /var/log/openerp/openerp-error.log <== CHANGE THIS VALUE
        CustomLog /var/log/openerp/openerp-access.log combined <== CHANGE THIS VALUE
        
            Order deny,allow
            Allow from all
        
        ProxyRequests Off
        ProxyPass / http://127.0.0.1:8069/
        ProxyPassReverse / http://127.0.0.1:8069/
        ProxyVia On
        LogLevel warn
    

Fill the file with this code (WITH SSL)


ServerName office.serayamotor.com
ServerAdmin [email protected]

    Redirect permanent / https://odoo.example.com/ // <== CHANGE THIS VALUE
    TransferLog /var/log/apache2/transfer.erp.your-domain.at.log



   ServerName odoo.example.com // <== CHANGE THIS VALUE
   ServerAdmin [email protected]  // <== CHANGE THIS VALUE

   
        Order deny,allow
        Allow from all
   
   ProxyRequests Off
   SSLProxyEngine on
   SSLEngine on
   SSLCertificateFile /etc/ssl/odoo/cacert.pem
   SSLCertificateKeyFile /etc/ssl/odoo/privkey.pem
   SSLCACertificateFile /etc/ssl/odoo/cacert.pem
   RequestHeader set "X-Forwarded-Proto" "https"
   SetEnv proxy-nokeepalive 1
        ProxyPass / http://127.0.0.1:8069/
        ProxyPassReverse / http://127.0.0.1:8069/
   ProxyErrorOverride off
   TransferLog /var/log/apache2/transfer.erp.your-domain.at.log
   #Fix IE problem (httpapache proxy dav error 408/409)
   SetEnv proxy-nokeepalive 1

Make the file symlinks to sites-enable directory

sudo ln -s /etc/apache2/sites-available/odoo.example.com.conf /etc/apache2/sites-enabled/odoo.example.com.conf

To disable Odoo on port 8069, please add 127.0.0.1 value on xmlrpc-interface= and netrcp-interface= located at

/etc/odoo/openerp-server.conf

Restart the apache and it should works.

Have fun..