Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Install and configure apache #515
Conversation
aden-chrome
added some commits
Nov 29, 2017
webteam-app
commented
Nov 30, 2017
|
User is not a collaborator of this repo. Please start demo manually. |
aden-chrome
referenced this pull request
Nov 30, 2017
Closed
Tutorial Wanted - install and configure Apache #484
|
Thanks for this @aden-chrome. Can you check you've committed the correct documents, as the committed files appear to document 'Install SSL with LetsEncrypt' rather than the 'Install and configure Apache' task linked in this issue? |
aden-chrome
added some commits
Nov 30, 2017
|
@degville sorry I think I pushed the tutorial onto a different branch.. |
|
No problem @aden-chrome, great work getting it updated so quickly! |
webteam-app
commented
Nov 30, 2017
|
Starting demo at: http://tutorials.ubuntu.com-pr-515.run.demo.haus/ |
degville
self-assigned this
Nov 30, 2017
degville
requested changes
Nov 30, 2017
Thank you for this, @aden-chrome, it's a really good tutorial.
I've left some in-line specific feedback to address some (mostly) minor issues. Please don't be put off by the number of comments - as you'll see, I can barely write a sentence without introducing a typo! But I've erred on the side of caution to try and show our typical process and the language elements we try to consider. Many of our documents go through several major revisions before they're published.
Fundamentally, your tutorial is sound. The only thing I'd consider adding is perhaps some local configuration for the reader in '/etc/hosts' so that they can test out the virtual host configuration without needing the actual domain names (or change their configuration if they have).
Also, you've include the SSL tutorial image and text files which need to be removed.
Otherwise, great work! Thanks again.
| @@ -0,0 +1,141 @@ | ||
| +--- | ||
| +id: install-and-configure-apache | ||
| +summary: This tutorial covers the installation and configuration of Apache web server on Ubuntu Server. |
| + | ||
| +--- | ||
| + | ||
| +#Install and Configure Apache |
degville
Nov 30, 2017
Contributor
There should be a single space between the '#' and '##' used to denote headings and the heading text. This needs to be applied to every other heading too, but I won't point it out again.
| +##Overview | ||
| +Duration: 1:00 | ||
| + | ||
| +Apache is an open source web server that's available for linux servers free of charge. |
| + | ||
| +Apache is an open source web server that's available for linux servers free of charge. | ||
| + | ||
| +In this tutorial we'll be going through the steps of setting up Apache server on your Ubuntu Server. |
degville
Nov 30, 2017
Contributor
an Apache server on your Ubuntu server (or machine, so there's no constant repeat of server).
| +- Some basic Apache configuration | ||
| + | ||
| +###What you'll need | ||
| +- A server running Ubuntu Server |
degville
Nov 30, 2017
Contributor
We should specify Ubuntu 16.04 LTS as this is the version with long term support and is well suited for this task.
| +- Secure Shell (SSH) access to your server | ||
| +- Basic Linux command line knowledge | ||
| + | ||
| +Have everything ready and want to have your website up and running as soon as possible? Click next to start! |
degville
Nov 30, 2017
Contributor
This conversational style is spot-on! It just needs a little tweaking to be more direct. For example: Got everything ready? Move on to the next step.
Also, there's no next button to click. If there was, there's no guarantee the tutorial will always be presented within the same web framework so it's usually best not to mention it.
| +##Installing Apache | ||
| +Duration: 1:00 | ||
| + | ||
| +To install Apache, we want to install the latest meta-package `apache2` by running |
degville
Nov 30, 2017
Contributor
I would remove 'we want to' to keep it snappy (although this is subjective!). Also, when followed with a command, it's best to finish a sentence with a colon.
| +Duration: 1:00 | ||
| + | ||
| +To install Apache, we want to install the latest meta-package `apache2` by running | ||
| +``` |
degville
Nov 30, 2017
Contributor
I can be helpful to mark code blocks with the code type. In most of these examples, that's bash. For example:
```bash
sudo apt update
sudo apt install apache2
```
This can help if we want to use different syntax highlighting for different types, or even if we ever wanted to automate testing and updating of the code!
| +sudo apt install apache2 | ||
| +``` | ||
| + | ||
| +After letting the command run, all required packages are installed and we can test it out by typing in our host name that's pointing to the server in a browser. |
degville
Nov 30, 2017
Contributor
I think it might be worth explaining hostname a little and maybe using the IP address of the server to test, as this is more likely to work and avoids us having to worry about DNS configuration, for example.
| + | ||
| +If you see the page above, it means that Apache has been successfully installed on your server! Let's move on. | ||
| + | ||
| +##Setting Up Our Webpage (Part 1) |
degville
Nov 30, 2017
Contributor
We're trying to standardise on sentence case, which means mostly only capitlising the first letter of the first word (exceptions include names, which is why Apache is ok above).
Also, I think the (Part X) addition in the title is a little confusing, although I understand you're trying to make this section easier to understand. Better to be more concise about what actually happens in these steps. Maybe 'create your own site' for this one?
| +##Setting Up Our Webpage (Part 1) | ||
| +Duration: 4:00 | ||
| + | ||
| +By default, Apache comes with a basic site (the one that we saw in the previous step) enabled. We can modify it's settings by editing its VirtualHost file found in `/etc/apache2/sites-enabled/000-default.conf` or it's content in `/var/www/html`. |
degville
Nov 30, 2017
Contributor
2 xits
I think you should point to /var/www/html first (as this is likely the most important thing), followed by a rephrasing of Virtual Hosts bit to say something like:
We can modify how Apache handles incoming requests and multiple sites running on the same server by editing its Virtual Hosts file.
| +positive | ||
| +: **VirtualHost file** | ||
| +A VirtualHost file contains configuration of our virtual host which enables Apache to recognize different host names. We can host multiple websites with different host names by adding multiple VirtualHost files and enabling them. | ||
| + |
degville
Nov 30, 2017
Contributor
This is a great explanation that I think works a little better within the main body of the text, and perhaps with a little tweaking to avoid repetition, for instance:
Virtual host configuration files enable Apache to recognize different host names and serve their sites from the same machine.
| +: **VirtualHost file** | ||
| +A VirtualHost file contains configuration of our virtual host which enables Apache to recognize different host names. We can host multiple websites with different host names by adding multiple VirtualHost files and enabling them. | ||
| + | ||
| +Today, we're going to leave the default Apache page to www.example.com and set up our own at gci.example.com. |
degville
Nov 30, 2017
Contributor
I'd write we're going to leave the default Apache virtual host configuration pointing to... to try and help beginners understand the different between the contents of a web page and how its served with Apache.
| +Today, we're going to leave the default Apache page to www.example.com and set up our own at gci.example.com. | ||
| +So let's start by creating a folder for our new website in `/var/www/` by running | ||
| +``` | ||
| +mkdir /var/www/gci/ |
degville
Nov 30, 2017
Contributor
We're going to need sudo with these commands (and a colon at the end of the sentence). Also, `bash' for the code type (and some of the following sections too).
| +``` | ||
| +mkdir /var/www/gci/ | ||
| +``` | ||
| +We have it named `gci` here but any name will work, as long as we point to it in the configuration file later. |
degville
Nov 30, 2017
Contributor
I'd put as long as we point to it in the virtual hosts configuration file as this helps reinforce what we're trying to accomplish and differentiate virtual host configuration from the wider (and much more complex) Apache configuration landscape.
| +``` | ||
| +We have it named `gci` here but any name will work, as long as we point to it in the configuration file later. | ||
| + | ||
| +Now that we have a directory created for our site, we want to have an HTML file in it. Let's go into our newly created directory and create one by typing |
| +cd /var/www/gci/ | ||
| +nano index.html | ||
| +``` | ||
| +We're using this for our `index.html` as an example |
degville
Nov 30, 2017
Contributor
We shouldn't make too many assumptions, so I think it's worth explicitly saying 'past the following' just in case this is someone's first time with HTML.
| +nano index.html | ||
| +``` | ||
| +We're using this for our `index.html` as an example | ||
| +```HTML |
| +``` | ||
| +Pretty cool, right? | ||
| + | ||
| +Now let's create a VirtualHost file for it so it'll show up when we type in gci.example.com |
| + | ||
| +Now let's create a VirtualHost file for it so it'll show up when we type in gci.example.com | ||
| + | ||
| +##Setting up Our Webpage (Part 2) |
| +Duration: 3:00 | ||
| + | ||
| +We start this step by going into the configuration files directory | ||
| +``` |
| +``` | ||
| +cd /etc/apache2/sites-available/ | ||
| +``` | ||
| +Since Apache came with a default VirtualHost file, let's use that as a base. (`gci.conf` is used here to match our subdomain name) |
| +``` | ||
| +cp 000-defualt.conf gci.conf | ||
| +``` | ||
| +Now we want to edit the configuration file |
| +``` | ||
| +nano gci.conf | ||
| +``` | ||
| +We want to have our email in `ServerAdmin` as Apache will display it alongside an error so users can reach you |
degville
Nov 30, 2017
Contributor
I'd say something like in case Apache experiences any errors so that this doesn't read like there will be an error.
| +``` | ||
| +You should see the following output | ||
| +``` | ||
| +root@ubuntu-server:/etc/apache2/sites-available# sudo a2ensite gci.conf |
| +service apache2 reload | ||
| +``` | ||
| + | ||
| +##End result |
| + | ||
| +Now is the moment of truth, let's type our host name in a browser. | ||
| + | ||
| +Hooray! |
degville
Nov 30, 2017
Contributor
Excellent ending. I think it might be useful to sign off with a few useful resources if the reader wants to take things further (things like extra reading and maybe IRC).
aden-chrome
added some commits
Dec 1, 2017
|
@degville Don't worry I'm not at all put off by your number of comments. In fact, I appreciate that you took the time to read through my entire tutorial and point out changes I should make and why it's better that way. I'll be sure to keep them in mind when I'm writing my next one! |
degville
requested changes
Dec 1, 2017
Excellent work! Thank you! Only a few very minor issues remaining, most of which I didn't spot in the first review.
| +We can modify how Apache handles incoming requests and have multiple sites running on the same server by editing its Virtual Hosts file. | ||
| + | ||
| +Today, we're going to leave the default Apache virtual host configuration pointing to www.example.com and set up our own at gci.example.com. | ||
| +So let's start by creating a folder for our new website in `/var/www/` by running |
degville
Dec 1, 2017
Contributor
There needs to be a carriage return between these two paragraphs. Also, even though this wasn't mentioned before, it might be worth making the web addresses bold (but putting double asterisks ** either side **).
| +``` | ||
| +Pretty cool, right? | ||
| + | ||
| +Now let's create a VirtualHost file so it'll show up when we type in gci.example.com |
| +``` | ||
| +Since Apache came with a default VirtualHost file, let's use that as a base. (`gci.conf` is used here to match our subdomain name): | ||
| +```bash | ||
| +cp 000-defualt.conf gci.conf |
aden-chrome
Dec 1, 2017
Contributor
we do, i keep forgetting to add them cause i was running everything as root :P
| +```bash | ||
| +ServerName gci.example.com | ||
| +``` | ||
| +This ensures people reach the right site instead of the default one when they type in gci.example.com |
degville
Dec 1, 2017
Contributor
This needs a full stop and maybe some 'bolding' around the web address?
| +root@ubuntu-server:/etc/apache2/sites-available# | ||
| + | ||
| +``` | ||
| +To load the new site, we restart Apache by typing |
|
@degville here ya go! |
|
@degville sorry I had to push some changes again, some of them were not updated remotely during the last push |
|
No problem, looks good. Thank you! |
|
you're welcome! ^^ |
aden-chrome commentedNov 30, 2017
New tutorial: Install and Configure Apache