9月 04, 2020 Apache
### Apache

Apache (httpd) is a web server application that can turn you machine into a web server. 

### Change apache settings

Open file `/etc/apache2/site-available/000-default.conf. You may see the following content:

![](https://cdn.19site.net/files/d9/5d/d95d3f68-44b0-43f9-8a83-fe17e65c72d6.png)

This is the default setting of Apache, you may copy these setting to create a new one.

![](https://cdn.19site.net/files/8f/98/8f98c6fa-f3b9-47f5-8a59-da806198b4c5.png)

Change port and document root.

Then open file `/etc/apache2/ports.conf`. 

![](https://cdn.19site.net/files/16/83/16830d02-eb9d-4c12-8275-5ce9bfc56d06.png)

Add `Listen 81` setting to config file.

### Check configuration file is valid

Before restart Apache service, better check the config files syntax is valid.

```sh
$ apachectl configtest
```

### Restart service

Restart Apache to apply new settings.

```sh
$ sudo service apache2 restart
```
過去文章
2025 (9)
4 (5)
3 (1)
2 (3)
2024 (25)
11 (3)
10 (3)
9 (1)
3 (18)
2022 (6)
10 (1)
6 (2)
5 (1)
3 (1)
1 (1)
2021 (21)
11 (7)
7 (1)
6 (2)
5 (2)
4 (6)
3 (2)
2 (1)
2020 (92)
12 (1)
11 (2)
10 (4)
9 (10)
8 (5)
7 (1)
6 (3)
5 (1)
4 (4)
3 (25)
2 (7)
1 (29)
2019 (57)
12 (25)
11 (7)
9 (25)