 Welcome to the introduction to WordPress and web servers. If you want to develop custom WordPress sites, plugins, or themes, it's important to understand how WordPress works under the hood. One of the first things you should learn about is how WordPress and web servers work together. In this lesson, you'll learn the basics of web servers and how they power your WordPress sites. At the most basic level, WordPress is a web application that runs on a web server. But what makes up a web server? And what makes it possible for the web server to run WordPress? A web server is merely a computer that is connected to the internet and configured to serve web pages. Web servers come in all shapes, sizes, and configurations, but ultimately they're all just computers, just like the one that you use every day. What makes a web server a little different is that it has specific software installed and configured to serve a web application like WordPress. WordPress runs on a tech stack called LAMP. LAMP stands for Linux, Apache, MySQL, and PHP. Linux is the operating system that manages the hardware and software resources on the server. Popular Linux distributions include Debian, Ubuntu, Red Hat, and CentOS. These operating systems are made up of the Linux kernel and a collection of software packages that are installed on top of the kernel. Apache, MySQL, and PHP are all installed via the package manager of the specific Linux distribution on the server. Apache is the web server software that is used to serve information on a web server. When you type a URL into your browser, the browser sends a request for some information to the server. The server then responds with the information that you requested. The web server software is what makes this possible. A popular alternative to Apache is called Nginx. Nginx is slightly newer and is generally considered to be faster and more efficient than Apache at serving static content. When using Nginx, the tech stack is referred to as LAMP, which stands for Linux, Nginx, MySQL, and PHP. By default, Apache and Nginx are configured to serve static files. Static files are files that don't change. Examples of static files include HTML files, image files, or video files. Additionally, HTML files can be styled using CSS and can be made more interactive using JavaScript. MySQL is a database software that is used to store information about the site and the server. For example, if you're running an online store, you will need to store information about the products that you're selling. This is where a MySQL database would come in. PHP is a programming language that is used to create dynamic web pages. PHP is a server-side language, which means that it is executed on the web server and the results are sent to the browser. In the online store example above, PHP is used to fetch the product information from the MySQL database and display it on the web page in the browser. When you install Apache or Nginx on a server, there are some files that you can configure to change the way the web server works. Generally, this configuration is done by a server system administrator. However, it's useful to understand one specific configuration set, and that's the configuration that allows a single instance of a web server to serve content for multiple websites. On Apache, this is known as a virtual host, and on Nginx, it's called a server block, but they both do the same thing. They allow you to configure the web server to serve different content for different websites. Here is an example of a virtual host configuration for Apache, and here is the same example, but for Nginx. In both examples, the web server is configured to listen for requests on port 80, which is the default port for web requests. When the server receives a request for the domain www.example.com, it will serve the files that are located in the directory forward slash www forward slash example one. By default, the web server is configured to look for a directory index file. If it finds one, it will serve that file. If it doesn't find one, it will return a 404 error. The default directory index file is usually index.html. When PHP is installed and enabled, it's possible to configure the web server to look for and serve a PHP file as the directory index. This is usually a file named index.php. In an Apache server configuration, this is done using the directory index directive. And in Nginx, this is done using the index directive. In both cases, index.php is placed before index.html in the list of files to look for. Most LAMP or LEMP web servers will have this configuration set up by default. So in this example, with the directory index file set, when you visit www.example.com in your browser, the web server will look for the index.php directory index file in the forward slash www forward slash example one directory and execute that file. If no index.php is found, it will look for and serve an index.html file. If no index.html file is found, it will return a 404 not found error. When a user visits a URL on a WordPress site, the following happens. The browser sends a request to the web server for the data at the URL that the user has entered. The web server receives the request and determines which files should be executed to serve the requested data. In a WordPress site, this will be the index.php file in the root directory for a front-end request or the specific file in the WP admin directory for an admin request. The PHP interpreter then executes the PHP code. If required, the PHP code will interact with the MySQL database and retrieve any required data. The PHP code will then output HTML and include any relevant CSS or JavaScript. The web server will send the HTML, CSS and JavaScript back to the browser. The browser will then render this code and display the relevant page to the user.