Install LAMP ubuntu 16.04

Install and configure LAMP

Install apache2:

sudo apt-get install apache2

Set Global ServerName to Suppress Syntax Warnings. Append in /etc/apache2/apache2.conf (bottom of the file):

ServerName IP_ADDRESS

Launch the command:

sudo apache2ctl configtest

you should receive the message Syntax OK.

Restart Apache to implement the changes:

sudo /etc/init.d/apache2 restart

Adjust the Firewall to Allow Web Traffic

sudo ufw app list

http://your_server_IP_address to see the welcome page from apache.

Install MySQL

sudo apt-get install mysql-server

Set a secure password for the root user and launch the script to remove some dangerous defaults and lock down access to our database system

sudo service mysql restart //restart the service
mysql_secure_installation

try the connection to the db with:

mysql -u root -p

Install PHP

sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

Modify the way that Apache serves files when a directory is requested serving php file before instead of html edit the file:

/etc/apache2/mods-enabled/dir.conf

And insert the php index file before:

<IfModule mod_dir.c>
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>

restart apache: sudo /etc/init.d/apache2 restart

test php with a phpinfo page.

Resources:

Docker ubuntu 16.0.4 on QNAP Container

Create and setup the container

Change the root password:

passwd root

to know the ip address we need to launch the command ifconfig but is not installed by default.

Install networks tool:

apt-get update
apt-get install net-tools
apt-get install openssh-server
apt-get install ufw

To allow connection from terminal enable ssh launch the command:

Install also:

apt-get install sudo
apt-get install vim
apt-get install software-properties-common

sudo service ssh restart

Docker: docker-container

Launch the commands from the container folder

  • Install the machine docker-compose build
  • Start the services docker-compose up -d
  • Stop the services docker-compose stop
  • Stop and remove containers, networks, images, and volumes docker-compose down
  • See active containers docker ps
CONTAINER ID        IMAGE                   COMMAND                  CREATED             STATUS              PORTS                    NAMES
27378c53e98a        eedtest_app             "docker-php-entrypoi…"   5 minutes ago       Up 5 minutes        0.0.0.0:8899->80/tcp     eedtest_app_1
68dfd5c7abde        mysql                   "docker-entrypoint.s…"   5 minutes ago       Up 5 minutes        0.0.0.0:3306->3306/tcp   eedtest_db_1
b18824235e76        phpmyadmin/phpmyadmin   "/run.sh phpmyadmin"     5 minutes ago       Up 5 minutes        0.0.0.0:8080->80/tcp     eedtest_phpmyadmin_1

doing this you can understand the port to see the webserver.

Clone this repo if you need a LAMP webserver

Media Query

Media Query

Mobile

Mobile portrait

@media only screen and (max-width: 767px){
  /* STYLES GO HERE */
}

Mobile landscape

@media only screen 
and (min-width: 320px) 
and (max-width: 767px)
and (orientation: landscape){
  /* STYLES GO HERE */
}

Tablet

Tablet in portrait and landscape (iPad)

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px)  { 
  /* STYLES GO HERE */
}

Note: use just min-width if you want use for responsive.

Tablet in landscape (iPad)

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : landscape) { 
  /* STYLES GO HERE */
}

Tablet in portrait (iPad)

@media only screen 
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) { 
  /* STYLES GO HERE */ 
}`

Mobile first approach

You should use min-width and then raise the pixels for different viewport:

@media (min-width: 40em) {
  /* STYLES GO HERE */
}

NO Mobile First

@media only screen and (max-width : 768px) {
  /* STYLES GO HERE */
}
@media only screen and (max-width: 1024px), screen and (max-height: 680px){
  /* STYLES GO HERE */
}
@media only screen and (max-width: 1024px) and (max-height: 768px) {
  /* STYLES GO HERE */
@media only screen and (max-width: 1440px) {
  /* STYLES GO HERE */
}

Target IE with media query

@media all and (-ms-high-contrast:none){
  /* STYLES GO HERE */
}

DB dump

myslqdump (mysql – mariadb)

EXPORT

export an entire database

$ mysqldump -u [username] -p --verbose db_name > db_backup.sql

export an entire database using gzip compression

$ mysqldump -u [username] -p[pass] --verbose db_name | gzip > db_backup.sql.gz

export from a remote database (presuming the MySQL server is on port 3306)

mysqldump -P 3306 -h [ip_address] -u [username] -p --verbose [database_name] > db_backup.sql

IMPORT

import sql data file

$ mysql -u [username] -p -h [db_ip_address_or_hostname] --verbose [database_name] < dumpData.sql

DROP

Drop a database

mysqladmin -u[username] -p[password] drop [database_name]