Skip to content

Commit

Permalink
Merge pull request #6 from casantosmu/add-nginx-cloudflare
Browse files Browse the repository at this point in the history
Add setting up https with cloudflare and nginx
  • Loading branch information
casantosmu committed Jun 20, 2024
2 parents 5169de1 + 7321ed0 commit 43a432b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
7 changes: 7 additions & 0 deletions docs/ubuntu-server/https.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# HTTPS

## Setting Up Cloudflare and Nginx

To host a website using Cloudflare and Nginx on Ubuntu 22.04, refer to this [tutorial](https://www.digitalocean.com/community/tutorials/how-to-host-a-website-using-cloudflare-and-nginx-on-ubuntu-22-04).

To be able to see the IP of the visitors, refer to the [official Cloudflare documentation](https://developers.cloudflare.com/support/troubleshooting/restoring-visitor-ips/restoring-original-visitor-ips/). To automate the process of updating the Cloudflare IP addresses, use the script on [nginx-cloudflare-real-ip](https://github.com/ergin/nginx-cloudflare-real-ip).
18 changes: 8 additions & 10 deletions docs/ubuntu-server.md → docs/ubuntu-server/setting-up.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
# Ubuntu Server
# Setting Up Ubuntu Server

## Setting Up Ubuntu Server

### 1. Accessing the Server
## 1. Accessing the Server

Access the server using an SSH client, substituting `server_ip` with the server IP address:

```bash
ssh root@server_ip
```

### 2. Updating the Server
## 2. Updating the Server

Update the server to ensure all packages are up to date:

```bash
apt update && apt upgrade -y
```

### 3. Creating a New User
## 3. Creating a New User

Create a new user with sudo privileges to avoid using the root account:

Expand All @@ -27,7 +25,7 @@ adduser newuser
usermod -aG sudo newuser
```

### 4. Configuring SSH Access
## 4. Configuring SSH Access

Configure SSH access by copying SSH keys from the root user to the new user:

Expand Down Expand Up @@ -58,7 +56,7 @@ Restart the SSH service:
systemctl restart ssh
```

### 5. Setting Up a Firewall
## 5. Setting Up a Firewall

Configure the firewall to allow essential services:

Expand All @@ -67,15 +65,15 @@ ufw allow OpenSSH
ufw enable
```

### 6. Disabling Root Login
## 6. Disabling Root Login

Disable root login for additional security:

```bash
passwd -l root
```

### 7. Fail2ban
## 7. Fail2ban

Install Fail2ban to protect the server from brute-force attacks:

Expand Down
4 changes: 3 additions & 1 deletion mkdocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ repo_url: https://github.com/casantosmu/code-notes

nav:
- Home: index.md
- Ubuntu Server: ubuntu-server.md
- Ubuntu Server:
- Setting Up: ubuntu-server/setting-up.md
- HTTPS: ubuntu-server/https.md
- Resources: resources.md

theme:
Expand Down

0 comments on commit 43a432b

Please sign in to comment.