Tag Archives: Apache

Topic 2 – Introduction to Computer Networks

Why do I need to learn about computer networks?

Because you will develop software system that usually connects with other software systems via various networks.

What can I do after finishing learning computer networks?

You will be able to set up various software systems such as Domain Name System, Active Directory System, Electronic Mail, File Transfer Protocol System, Remote Desktop Services, File Services, HTTP Services.

You will be prepared to learn about network programming, game development, web application development, and distributed systems and blockchain.

What should I do now?

Please audit this course and complete all the quizzes, to learn about computer networking concepts: The Bits and Bytes of Computer Networking.

Alternatively, you can read the books below to learn about computer networking concepts:

After that, please read this book to get hands-on experience with networking labs: Brian Svidergol et al. (2018). Mastering Windows Server 2016. Wiley.

After that, please read this book to learn about the problems and their coresponding solutions for building networks: Larry L. Peterson and Bruce S. Davie (2021). Computer Networks: A Systems Approach. Morgan Kaufmann.

Terminology Review:

  • Computer Networking.
  • Computer Networks, Peer-to-Peer Systems, Local Area Networks, Wide Area Networks, Virtual Private Networks, ISP Networks, The Internet.
  • Network Software, Distributed Systems, World Wide Web, Network Protocols.
  • The OSI Reference Model: The Physical Layer, The Data Link Layer, The Network Layer, The Transport Layer, The Session Layer, The Presentation Layer, The Application Layer.
  • The TCP/IP Reference Model: The Link Layer, The Internet Layer, The Transport Layer, The Application Layer.
  • The TCP/IP 5-Layer Model: The Physical Layer, The Data Link Layer, The Network Layer, The Transport Layer, The Application Layer.
  • Network Interface Cards, RJ45 Ports and Plugs, Cables, Hubs, Switches, Routers, Servers, Clients, Nodes.
  • Bit, Octet (Byte), Modulation, Line Coding, Twisted Pair Cables, Simplex Communication, Duplex Communication, Full-Duplex, Half-Duplex.
  • Collision Domain, Ethernet, Carrier-Sense Multiple Access with Collision Detection (CSMA/CD), MAC Address.
  • Unicast, Broadcast, Multicast.
  • Data Packet, Ethernet Frame, Virtual LAN (VLAN), VLAN Header.
  • First-in-First-Out (FIFO).
  • IPv4 Addresses, IIPv4 Datagrams, IPv4 Address Classes, Address Resolution Protocol (ARP), Subnet Masks, CIDR (Classless Inter-Domain Routing).
  • Routing Tables, Autonomous System, Interior Gateway Protocols,  Exterior Gateway Protocols, Distance Vector Routing Protocols, Link State Routing Protocols, Core Internet Routers, Border Gateway Protocol (BGP), Non-Routable Address Space.
  • Multiplexing, Demultiplexing, Ports.
  • TCP Segment, TCP Control Flags, Three-way Handshake, Four-way Handshake, Transmission Control Protocol (TCP), TCP Socket, TCP Socket States.
  • Connection-Oriented Protocols, Connectionless Protocols.
  • User Datagram Protocol (UDP).
  • Firewall.
  • Network Address Translation.
  • Frames, Packets, Messages.
  • Network Socket.
  • Transport Service Primitives: LISTEN, CONNECT, SEND, RECEIVE, DISCONNECT.
  • Domain Name System (DNS).
  • Electronic Mail, SMTP Protocol.
  • FTP (File Transfer Protocol), FTPS (File Transfer Protocol Secure), SFTP (SSH File Transfer Protocol).
  • Remote Desktop Services.
  • File Services.
  • HTTP Services.
  • Time Services.
  • Short Message Service (SMS).
  • Public Switched Telephone Network (PSTN), Plain Old Telephone Service (POTS), Modems, Dial-up (Phone Lines), Usenet.
  • Broadband, T-Carrier Technologies, Digital Subscriber Line (DSL, Phone Lines), Asymmetric Digital Subscriber Line (ADSL), Symmetric Digital Subscriber Line (SDSL), High Bit-Rate Digital Subscriber Line (HDAL), Digital Subscriber Line Access Multiplexers (DSLAM).
  • Cable Broadband (Television Lines), Cable Modems, Cable Modem Termination System (CMTS).
  • Fiber to the X (FTTX), Fiber to the Neighborhood (FTTN), Fiber to the Building (FTTB), Fiber to the Home (FTTH), Fiber to the Premises (FTTP), Optical Network Terminator.
  • Point to Point Protocol (PPP), Network Control Protocol (NCP), Link Control Protocol (LCP), Point to Point Protocol over Ethernet (PPPoE).

After finishing computer networks, please click on Topic 3 – Introduction to Programming to continue.

 

How to move a WordPress instance from one server to another Linux server

Motivation:

You want to move a WordPress instance from one server to another to consolidate your websites to reduce cost.

Solution:

Install and use below Duplicator plugin to achieve your goal.

https://wordpress.org/plugins/duplicator/

User guide: https://snapcreek.com/duplicator/docs/quick-start/

If everything goes well for you then congratulation!

Otherwise, please review below possible problems and corresponding solutions.


Problem 1:

You don’t have a website on the new server.

Solution 1:

1. Create a new virtual host in the /etc/httpd/conf/httpd.conf

<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot "/var/www/www.example.com"
</VirtualHost>

2. Set 775 permission for /var/www/www.example.com

3. Restart httpd service

sudo systemctl restart httpd

Problem 2:

You are using Amazon Linux 2 server.

You are logged in as ec2-user.

You use WinSCP to upload files and edit configuration files.

You cannot modify /etc/httpd/conf/httpd.conf and /etc/php.ini.

Solution 2:

1 View permission settings for the file

ls -ld /etc/httpd/conf/httpd.conf

The result indicates that the file owner is root user and root group, not ec2-user.

2. View groups of a user

groups ec2-user

The result indicates that the ec2-user does not belong to root group.

3. Add a user to root group

sudo usermod -a -G root ec2-user

4. Grant Read-Write permission against a file to root group

sudo chmod g+rwx /etc/httpd/conf/httpd.conf
sudo chmod g+rwx /etc/php.ini

5. Logout and login to the server again.


Problem 3:

You are using Amazon Linux 2 server. The ZipArchive feature is missing.

Solution 3:

1. Execute below commands:

sudo amazon-linux-extras install php7.2
sudo yum install php-pear php-devel gcc libzip-devel zlib-devel
sudo pecl install zip-1.13.5 # we must specify a slightly older version due due to compatibility

2. Add “extension=zip.so” to /etc/php.ini

3. Restart the server

sudo reboot

Problem 4:

You don’t have a WordPress database on the new Linux server.

Solution 4:

Execute below MySQL commands:

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE `wp_database`;
GRANT ALL PRIVILEGES ON `wp_database`.* TO "username"@"localhost";
FLUSH PRIVILEGES;

Problem 5:

An database error occurs while restoring a website.

Solution 5:

1. Execute below commands to remove the website:

sudo chown -R ec2-user:apache /var/www/example.com
sudo chmod 2775 /var/www/example.com && find /var/www/example.com -type d -exec sudo chmod 2775 {} \;
find /var/www/example.com -type f -exec sudo chmod 0664 {} \;
rm -r /var/www/example.com

2. Upload the Duplicator files again, and restore the website again.


Problem 6:

No write access against /var/www/example.com is available for Duplicator.

Solution 6:

1. Execute below commands:

sudo chown -R ec2-user:apache /var/www/example.com
sudo chmod 2775 /var/www/example.com && find /var/www/example.com -type d -exec sudo chmod 2775 {} \;
find /var/www/example.com -type f -exec sudo chmod 0664 {} \;

2. Run http://example.com/installer.php again.

Topic 8 – Introduction to Web Application Development

Why do I need to learn about web application development?

Desktop applications are very powerful and convenient but their development, deployment and maintenance are daunting.

The reason is that the platform dependency makes it very expensive to create a desktop application working on different versions of different operating systems, such as Windows, Linux and Mac OSX.

Deployment and updates of desktop application typically require high privileges access to a computer machine, causing a problem for companies requiring high security.

Fortunately, you can overcome these limitations by creating a web application running on a browser. To create a web application you need to learn about web application development.

What can I do after finishing learning web application development?

You will be able to create web applications like The BBC News, The WordPress Blog or The White House Website.

This is exactly what I want to learn! What should I do now?

Web application development requires a lot of reading. You have to master networking concepts, HTML, CSS, JavaScript, a programming language and a database management system for web.

First, please read the two books below to get familiar with web application development concepts, and gain hands-on experience with HTML and CSS.

After that,  please read the two books below to learn in-depth about HTML and CSS.

JavaScript is the language for web development because it is implemented in most of the web browsers. Strong knowledge of JavaScript will ease your web development learning very much. Please read the books below to learn about JavaScript.

Single page application is the default front-end choice for most of new web development projects.
Please read the books below to learn how to create a single page application (SPA).

After that, please read the books below to learn how to create micro-frontends.

After that you will have 4 main options. You can choose one of them. We STRONGLY recommend that you choose only ONE option.

You should NOT learn all of them at the beginning. You could save your time by digging into only one option. After mastering the selected technology, you will realize that all of them are very similar in the sense of use.

One note is that although their concepts are similar to one another but it still takes us much time to learn how to apply an approach to real world web application.

When developing a real world web application, you often use only one or two of these 4 approaches. If you cannot make your own selection then we recommend you
– a combination of the first and second option, or
– a combination of the first and third option, or
– a combination of the first and fourth option.

The first option is PHP world.  Please read one of the following books to learn how to create web applications using PHP:

After that, After that, if your projects use WordPress, you may read this book: Brad Williams et al. (2015). Professional WordPress: Design and Development. Wrox.

The second option is ASP.NET. Please read the two books below to learn how to create web applications using ASP.NET:

A complementary part for this option is ASP.NET Web Forms that is a technology that you need to master if you are maintaining a legacy project. Please read this book to learn about ASP.NET Web Forms: Imar Spaanjaars (2014). Beginning ASP.NET 4.5.1 in C# and VB. Wrox.

The third option is Java world. If you are not familiar with Java language then please read the two books below first:

After that, please read one of the following books to learn how to create web applications using Java.

After that, please read this book to learn how to speed up Java web application development using Spring Boot framework: Mark Heckler (2021). Spring Boot – Up and Running – Building Cloud Native Java and Kotlin Applications. O’Reilly Media.

The 4th option is Node.js world. Please read the two books below to learn how to create web applications using Node.js:

There are also several other options that you may consider if you are required to learn them for maintening a project.
These options include:
Ruby on Rails, please read this book: Michael Hartl (2020). The Ruby on Rails Tutorial. Addison-Wesley Professional,
Flask, please read this book: Miguel Grinberg (2018). Flask Web Development: Developing Web Applications with Python. O’Reilly Media,
Django
.

IIf you need to convert a web application from one platform to another or create a web application framework, please read the two books below to learn about the architecture of web applications:

It seems that there are many topics to learn. I am completely new to web programming. What essential knowledge should I focus on to reduce my learning time?

You could focus on these topics first:

  • How to install necessary tools and create a Hello World application.
  • What is the physical structure of a project and how to build it using both IDE and command line?
  • How to deploy an application to a cloud virtual machine and access it via an URL.
  • How to create UIs, transfer data between UIs, compose new UI using existing UIs using frameworks and libraries.
  • How to use built-in or 3rd party libraries to interact with external databases and external services.
  • How to integrate with other web services using standards.

Terminology Review:

  • Networking
  • HTTP
  • HTML
  • Cascading Style Sheets (CSS)
  • CGI
  • Web Applications
  • Multiple Page Application
  • Single-Page Application (SPA)
  • RESTful APIs
  • gRPC APIs
  • GraphQL APIs
  • XML
  • SOAP APIs
  • Web Application Frameworks
  • Portal Frameworks
  • Content Management System (CMS)
  • Payment Gateways

After finishing web application development, please click on Topic 9 – Introduction to Mobile Application Development to continue.