Update the Creating a LAMP Server document for stateless requirements

Add additional steps to change the default Apache DocumentRoot to /etc/www/html by adding additional .conf files in /etc/httpd/conf.d and changing all references to this new DocumentRoot directory.
This commit is contained in:
Tom Leavitt
2017-08-10 11:25:54 -07:00
committed by GitHub
parent 65b6970ff0
commit c08e8dc5d2
@@ -71,7 +71,74 @@ browser as shown in figure 1.
Confirmation the Apache service is running.
The :file:`index.html` file is located in the :file:`/usr/share/httpd/htdocs`
directory of your host system.
directory of your host system. We will copy this file into a new location
after we modify the configuration.
Change the Default Configuration and Data Directory
===================================================
|CL| is designed to be a stateless operating system which means that you will
need to create an optional configuration file. The default location of the
Apache configuration file, httpd.conf, is located in the
/etc/share/defaults/httpd directory, which can be overwritten as part of the
stateless paradigm. This default .conf file includes the following directives
that allow for additional locations of configuration definitions:
.. code-block:: console
# Virtual hosts
IncludeOptional /usr/share/defaults/httpd/conf.d/*.conf
IncludeOptional /usr/share/defaults/httpd/conf.modules.d/*.conf
IncludeOptional /etc/httpd/conf.d/*.conf
IncludeOptional /etc/httpd/conf.modules.d/*.conf
For this tutorial, we will create the directory structure for /etc/httpd/conf.d
and then create the httpd.conf file within /etc/httpd/conf.d directory and
include the variable DocumentRoot.
Using your favorite editor, copy the content listed below into the new file
:file:`/etc/httpd/conf.d/httpd.conf`
.. code-block:: console
#
# Set a new location for DocumentRoot
#
DocumentRoot “/var/www/html”
#
# Releax access to content within /var/www/html for this tutorial
#
<Directory “/var/www/html”>
AllowOverride none
Require all granted
</Directory>
Finally, lets create the new DocumentRoot directory structure and copy the
index.html file from /usr/share/httpd/htdocs directory to /var/www/html.
.. code-block:: console
sudo mkdir p /var/www/html
cd /var/www/html
sudo cp /usr/share/httpd/htdocs/index.html .
To make sure that we have everything set correctly, lets edit the new
index.html file with your favorite editor and change the text from
“It works” to “It works in its new location”.
With the new configuration files in place, you will need to stop and then restart the httpd.service
.. code-block:: console
sudo systemctl stop httpd.service
sudo systemctl start httpd.service
Now when you go to http://localhost you should see your new screen.
Installing PHP
==============
@@ -98,7 +165,7 @@ To enable PHP, enter the following commands:
After restarting the Apache service, we can test our PHP installation.
1. Create a file named :file:`phpinfo.php` in the
:file:`/usr/share/httpd/htdocs/` directory using your favorite editor.
:file:`/var/www/html/` directory using your favorite editor.
2. Add the following line to the file:
@@ -279,7 +346,7 @@ our |CL| host system.
.. code-block:: console
cd /usr/share/httpd/htdocs
cd /var/www/html
sudo tar xzvf ~/Downloads/phpMyAdmin-4.6.4-english.tar.gz
3. To keep things simple, rename the newly created
@@ -329,7 +396,7 @@ our new database WordPress.
The `Databases` tab of `phpMyAdmin`.
2. Enter 'Wordpress'. in the text field below the :guilabel:`Create database`
2. Enter 'WordPress'. in the text field below the :guilabel:`Create database`
label.
3. Pick the :guilabel:`utf8_unicode_ci` option from the collation drop-down