This page is under construction
Web development involves creating web pages statically and dynamically. However modern web mostly designed with dynamic and responsiveness in mind. Both client and server side development is required to create a complete webpage, from basic HTML, CSS to scripting techniques like ?JavaScript, and other database technologies (server sided).
Tools required:
Usually, the following tools are required to create a complete website. However, in the day of rapidly changing technology of web development, these tools can get easily depreciated. They are usually involving
- A computer of course
- A text editor
- A Web Browser
- A vector graphics editor
- An FTP program
- An automation system
Various frameworks, templates and libraries and more! Installing a text editor: You can install any text editor of your choice via Debian package manager
$ sudo apt install geany
There are tons of text editors available in Debian. Please see the section “Text Editor”.
Installing a Web Browser
You definitely need a web browser to test code via HTML and DOM (Document Object Model). You can install it via apt as below:
$ sudo apt install firefox
Other recommended option is chromium, which "Google" ripped off with their own branding name “Chrome”.
Installing a Vector Graphics Editor
like GIMP, or Inkscape to make images for your web pages.
$ sudo apt install gimp inkscape
Installing MariaDB
$ sudo apt update $ sudo apt install mariadb-server $ sudo mysql_secure_installation
The script will prompt you to set a password for the root account, remove the anonymous user, restrict root user access to the local machine and remove the test database. In the end, the script will reload the privilege tables ensuring that all changes take effect immediately. All steps are explained in detail and it is recommended to answer “Y” (yes) to all questions.
To connect to the MariaDB server through the terminal as the root account type:
$ mysql -u root -p
Installing Apache2
Step 1: Install apache2
$ sudo apt install apache2
Step 2: Adjust the firewall
$ sudo ufw app list $ sudo ufw allow ‘WWW’ $ sudo ufw status
Step 3: Test the server
Get the IP address and paste it to your browser address bar, you should notice Apache Server homepage.
$ hostname -I
Apache services can be handled via Debian's service management system (in systemd, it’s systemctl).
Step 3: Set up virtual hosts
If you want to encapsulate configurations and manage more than one domain from a single web server, you can set up virtual hosts. Now let’s consider the domain name as “example.com”.
First we will create a directory structure inside /var/www without modifying /var/www/html for fallback for client requests.
$ sudo mkdir -p /var/www/example.com/html # Create our domain $ sudo chown -R $USER:$USER /var/www/example.com/html # Obtain domain Ownership $ sudo chmod -R 755 /var/www/example.com/html # Setup proper permissions $ nano /var/www/example.com/html/index.html # Sample index page
When done, save and close the page, and now in order to serve this content, it’s necessary to create a virtual host file with the correct directives. Create your custom directive, inside /etc/apache2/sites-available/example.com.conf and fill with proper values. Save and close the file when you are done.
$ sudoedit /etc/apache2/sites-available/example.com.conf
<VirtualHost *:80> ServerAdmin admin@example.com # Server admin with root access ServerName example.com # Base domain ServerAlias www.example.com DocumentRoot /var/www/example.com/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Now enable example.com site and disable the default configuration 000-default.conf with
$ sudo a2ensite example.com.conf # For enabling the domain $ sudo a2ensite 000-default.conf # For disabling a domain $ sudo systemctl restart apache2 # For restarting the apache service
Now apache2 should be serving your domain. You can test this by navigating to https://example.com via your preferred browser
Automated testing
Kindly check: Mozilla Automated testing page for more