Friday, January 18, 2019

Host a addon domain in Crazydomain.com


Main domain under hosting: fresh.com.au

Host Server Information:
Server's shared IP Address: 103.68.166.65

Default:
Name Server: NS2.CRAZYDOMAINS.COM
Name Server: NS1.CRAZYDOMAINS.COM

DNS Settings:
A Record              freshexport.com.au                203.170.80.250
A Record              sophrecruit.com                     103.67.235.120

www.sophrecruit.com                  103.67.235.120 
sophrecruit.com                            203.170.80.250 
www.sophrecruit.com                  203.170.80.250


Modification setting:
Name Server: ns1.syrahost.com
Name Server: ns2.syrahost.com
For Email Hosting, WordPress Hosting, Web Hosting (Linux), Sitebeat (Website/eShop Builder) 
And, for Hosting Manager - cPanel

DNS settings:
A Record              example.com    103.68.166.65(Shared IP Address)



Tuesday, January 15, 2019

Docker essential commands

View running instances:
$ docker ps

View all instances including stopped one:
$ docker ps -a

View all downloaded images in the system:
$ docker images

Instantiate and run an image:
$ docker run -it --name x1 ubuntu bash
Here, i = interactive
t = terminal

$ docker run -d -p x1

(location to docker file)
$ docker build -t x1

Remove an instance:
$ docker rm
$ docker rmi

Start / Stop instance:
$ docker stop x1
$ docker start x1

Map a local drive to a docker instance:
$ docker rm -d -p -v /home/kd/myCode:/var/www/html

Set Up IP and Port-Based Virtual Hosting (Vhosts) With Apache Web Server on FreeBSD

I am going to create two virtual hosts, namely microtechna_com and nextcloud15.

Create the Directory Structure:
# mkdir /usr/local/www/apache24/microtechna_com
# mkdir /usr/local/www/apache24/nextcloud15

Ownership to webserver user(www user in www group in freebsd):
# chown -R www:www /usr/local/www/apache24/nextcloud15
# chown -R www:www /usr/local/www/apache24/microtechna_com/

Grant write permissions for group/other:
# chmod -R go+w /usr/local/www/apache24/nextcloud15/
# chmod -R go+w /usr/local/www/apache24/microtechna_com/

See the Permissions:
# ls -la /usr/local/www/apache24/nextcloud15/
# ls -la /usr/local/www/apache24/microtechna_com/

Create Demo Pages for Each Virtual Host:
# ee /usr/local/www/apache24/microtechna_com/info.php
# ee /usr/local/www/apache24/nextcloud15/info.php
<?php infophp(); ?>

Backup httpd.conf:
# cp /usr/local/etc/apache24/httpd.conf /usr/local/etc/apache24/httpd.conf.orginal

Backup httpd-vhosts.conf
# cp /usr/local/etc/apache24/extra/httpd-vhosts.conf /usr/local/etc/apache24/extra/httpd-vhosts.conf.orginal
# cp /usr/local/etc/apache24/extra/httpd-vhosts.conf.orginal /usr/local/etc/apache24/extra/httpd-vhosts.conf

To set up multiple ports, you need to edit the httpd.conf file:
# ee usr/local/etc/apache24/httpd.conf
Add/edit the following lines:

Listen 192.168.1.42:80
Listen 192.168.1.43:8080

Understanding the directive:
ServerRoot "/usr/local"
Specifies the default directory hierarchy for the Apache installation. Binaries are stored in the bin and sbin subdirectories of the server root and configuration files are stored in the etc/apache2x subdirectory.

ServerAdmin you@example.com
Change this to the email address to receive problems with the server. This address also appears on some server-generated pages, such as error documents.

ServerName www.example.com:80
Allows an administrator to set a hostname which is sent back to clients for the server. For example, www can be used instead of the actual hostname. If the system does not have a registered DNS name, enter its IP address instead. If the server will listen on an alternate report, change 80 to the alternate port number.

DocumentRoot "/usr/local/www/apache2x/data"


Create the First Virtual Host:
# vi /usr/local/etc/apache24/extra/httpd-vhosts.conf


Running # apachectl configtest; should return Syntax OK.
or, # service apache24 configtest

This command will dump out a description of how Apache parsed the configuration file.
# apachectl -S

Restart Apache:
# service apache24 restart

Check VirtualHost Configuration Syntax
# /usr/local/apache2/bin/httpd -S

FreeBSD firewall IPFW port check:
IPFW stateful firewall written for FreeBSD
# ee /etc/rc.conf

Essential Directory list:
# ls /usr/local/etc/apache24/httpd.conf
# ls /usr/local/www/apache24/microtechna_com/ index.html
# vi /usr/local/etc/apache24/extra/httpd-vhosts.conf

Ref links:
Apache HTTP Server
Apache Virtual Host documentation
httpd - Apache Hypertext Transfer Protocol Server
IPFW stateful firewall written for FreeBSD


<VirtualHost *:80>
    ServerName 192.168.10.114:8080
    ServerAlias example
    DocumentRoot "/usr/local/www/apache24/nextcloud15"
    DirectoryIndex index.php index.html

    <Directory /usr/local/www/apache24/nextcloud15>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>

    <FilesMatch \.php$>
         SetHandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://localhost/"
    </FilesMatch>

    ErrorLog /var/log/nextcloud15-error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/nextcloud15-access.log combined
</VirtualHost>

Monday, January 14, 2019

Mikrotik essential commands:

Reset from the GUI: reset is better, check the 3 boxes.
/ system reset-configuration
/ system reset-configuration keep-users=yes no-defaults=yes run-after-reset=flash/nhan02.rsc

Reboot:/ system reboot

Script export without the line wrap:

/ export terse file=dump

Securing Mikrotik: checklist


9 Tips to Secure your router: https://www.phallaccmt.com/2018/03/143-mikrotik-how-to-secure-your-router.html

1. Not using default username/password = ok

2. Using complex password = ok

3. Allow only specific user to access your router: /User (allow-address) = ok

4. Allow only used /ip service and change default port = ok

5. Disable Mac-telnet, Mac-Ping and Mac-Winbox: /tool mac-server = ok

6. Disable neighbor discovery protocol = ok

7. Disable BTest Server: /tool BTest-server = ok

8. Disable Allow Remote Requests: /ip dns = ok

9. Disable unuse interface/service = ok

Ref: https://wiki.mikrotik.com/wiki/Manual:Securing_Your_Router

Natural scrolling windows 10

Edit the regedit file in windows GUI: