Skip to content

Commit 806ef24

Browse files
authored
Testing a new NvChad interface by editing this file (rocky-linux#1888)
* add fenced code block tags where necessary * remove hard tabs in parts of the Apache configuration * remove errant spaces and line feeds * add correct emphasis characters
1 parent ce58a28 commit 806ef24

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

docs/guides/web/apache-sites-enabled.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,24 @@ Historical fact: This server setup appears to have started with Debian-based sys
3131
For those looking for a similar setup for Nginx, [examine this guide](nginx-multisite.md).
3232

3333
## Install Apache
34+
3435
You will likely need other packages for your website, such as PHP, database, or other packages. Installing PHP along with `http` will get you the most recent version from the Rocky Linux repositories.
3536

3637
Just remember that you may need modules, such as `php-bcmath` or `php-mysqlind`. Your web application specifications will dictate what you need. You can install these when needed. For now, you will install `http` and PHP, as those are almost a forgone conclusion:
3738

3839
From the command-line run:
3940

40-
```
41+
```bash
4142
dnf install httpd php
4243
```
4344

4445
## Add extra directories
4546

4647
This method uses a couple of additional directories, which do not currently exist on the system. You need to add two directories in */etc/httpd/* called "sites-available" and "sites-enabled."
4748

48-
From the command-line enter:
49+
From the command-line enter:
4950

50-
```
51+
```bash
5152
mkdir -p /etc/httpd/sites-available /etc/httpd/sites-enabled
5253
```
5354

@@ -57,15 +58,15 @@ You also need a directory where our sites are going to be. This can be anywhere,
5758

5859
## Configuration
5960

60-
You also need to add a line to the bottom of the `httpd.conf` file. To do this, enter:
61+
You also need to add a line to the bottom of the `httpd.conf` file. To do this, enter:
6162

62-
```
63+
```bash
6364
vi /etc/httpd/conf/httpd.conf
6465
```
6566

6667
and go to the bottom of the file and add:
6768

68-
```
69+
```bash
6970
Include /etc/httpd/sites-enabled
7071
```
7172

@@ -87,9 +88,9 @@ If you want to serve the website with SSL/TLS (and face it, in most cases you do
8788

8889
You can examine that below in the [Configuration `https` using An SSL/TLS certificate](#https) section.
8990

90-
You first need to create this configuration file in *sites-available*:
91+
You first need to create this configuration file in *sites-available*:
9192

92-
```
93+
```bash
9394
vi /etc/httpd/sites-available/com.wiki.www
9495
```
9596

@@ -104,8 +105,8 @@ The configuration file content will look something like this:
104105
Alias /icons/ /var/www/icons/
105106
# ScriptAlias /cgi-bin/ /var/www/sub-domains/your-server-hostname/cgi-bin/
106107
107-
CustomLog "/var/log/httpd/your-server-hostname-access_log" combined
108-
ErrorLog "/var/log/httpd/your-server-hostname-error_log"
108+
CustomLog "/var/log/httpd/your-server-hostname-access_log" combined
109+
ErrorLog "/var/log/httpd/your-server-hostname-error_log"
109110
110111
<Directory /var/www/sub-domains/your-server-hostname/html>
111112
Options -ExecCGI -Indexes
@@ -124,21 +125,21 @@ When created, you need to write (save) it with ++shift+:+wq++.
124125

125126
In the example, loading the wiki site happens from the "html" subdirectory of _your-server-hostname_, which means that the path you created in _/var/www_ (above) will need some additional directories to satisfy this:
126127

127-
```
128+
```bash
128129
mkdir -p /var/www/sub-domains/your-server-hostname/html
129130
```
130131

131132
This will create the entire path with a single command. Next you want to install your files to this directory that will actually run the website. This might be something you made yourself, or an installable web application (in this case a wiki) that you downloaded.
132133

133134
Copy your files to the path you created:
134135

135-
```
136+
```bash
136137
cp -Rf wiki_source/* /var/www/sub-domains/your-server-hostname/html/
137138
```
138139

139140
## <a name="https"></a>Configuration `https` using an SSL/TLS certificate
140141

141-
As stated earlier, every web server created these days _should_ be running with SSL/TLS (the secure socket layer).
142+
As stated earlier, every web server created these days *should* be running with SSL/TLS (the secure socket layer).
142143

143144
This process starts by generating a private key and CSR (certificate signing request) and submitting the CSR to the certificate authority to buy the SSL/TLS certificate. The process of generating these keys is somewhat extensive.
144145

@@ -148,15 +149,15 @@ You can also use this alternate process, using an [SSL certificate from Let's En
148149

149150
### Placement of the SSL/TLS keys and certificates
150151

151-
Since you have your keys and certificate files, you need to place them logically in your file system on the web server. As you have seen with the example configuration file, you are placing your web files in _/var/www/sub-domains/your-server-hostname/html_.
152+
Since you have your keys and certificate files, you need to place them logically in your file system on the web server. As you have seen with the example configuration file, you are placing your web files in `/var/www/sub-domains/your-server-hostname/html`.
152153

153-
You want to place your certificate and key files with the domain, but outside of the document root, which in this case is the _html_ folder.
154+
You want to place your certificate and key files with the domain, but outside of the document root, which in this case is the *html* folder.
154155

155156
You never want to risk exposing your certificates and keys to the web. That would be bad!
156157

157158
Instead, you will create a directory structure for our SSL/TLS files, outside the document root:
158159

159-
```
160+
```bash
160161
mkdir -p /var/www/sub-domains/your-server-hostname/ssl/{ssl.key,ssl.crt,ssl.csr}`
161162
```
162163

@@ -166,9 +167,9 @@ If you are new to the "tree" syntax for making directories, what the above says
166167

167168
Just a note ahead of time: Storing the certificate signing request (CSR) file in the tree is not necessary, but it simplifies some things. If you ever need to re-issue the certificate from a different provider, having a stored copy of the CSR is a good idea. The question becomes where can you store it so that you will remember, and storing it within the tree of your website is logical.
168169

169-
Assuming that you have named your key, csr, and crt (certificate) files with the name of your site, and that you have them stored in _/root_, you will copy them up to their locations:
170+
Assuming that you have named your key, csr, and crt (certificate) files with the name of your site, and that you have them stored in */root*, you will copy them up to their locations:
170171

171-
```
172+
```bash
172173
cp /root/com.wiki.www.key /var/www/sub-domains/your-server-hostname/ssl/ssl.key/
173174
cp /root/com.wiki.www.csr /var/www/sub-domains/your-server-hostname/ssl/ssl.csr/
174175
cp /root/com.wiki.www.crt /var/www/sub-domains/your-server-hostname/ssl/ssl.crt/
@@ -182,7 +183,6 @@ For starters, break down the beginning of the configuration file. For instance,
182183

183184
You want them to go to port 443 (or "`http` secure", better known as SSL/TLS or `https`). Our port 80 configuration section will be minimal:
184185

185-
186186
```apache
187187
<VirtualHost *:80>
188188
ServerName your-server-hostname
@@ -211,8 +211,8 @@ Next, you need to define the `https` part of the configuration file:
211211
Alias /icons/ /var/www/icons/
212212
# ScriptAlias /cgi-bin/ /var/www/sub-domains/your-server-hostname/cgi-bin/
213213
214-
CustomLog "/var/log/`http`d/your-server-hostname-access_log" combined
215-
ErrorLog "/var/log/`http`d/your-server-hostname-error_log"
214+
CustomLog "/var/log/`http`d/your-server-hostname-access_log" combined
215+
ErrorLog "/var/log/`http`d/your-server-hostname-error_log"
216216
217217
SSLEngine on
218218
SSLProtocol all -SSLv2 -SSLv3 -TLSv1
@@ -254,11 +254,10 @@ Remember that our *httpd.conf* file is including */etc/httpd/sites-enabled* at t
254254

255255
That is by design, so that you can remove things when or if `httpd` fails to restart. To enable our configuration file, you need to create a symbolic link to that file in *sites-enabled* and start or restart the web service. To do this, you use this command:
256256

257-
```
257+
```bash
258258
ln -s /etc/httpd/sites-available/your-server-hostname /etc/httpd/sites-enabled/
259259
```
260260

261-
262261
This will create the link to the configuration file in *sites-enabled*.
263262

264263
Now just start `httpd` with `systemctl start httpd`. Or restart it if it is already running: `systemctl restart httpd`, and assuming the web service restarts, you can now go and do some testing on your site.

0 commit comments

Comments
 (0)