|
1 | 1 | --- |
2 | 2 | title: Server Setup |
3 | 3 | description: No matter which VPS option you choose, you'll need to make sure that you have the required software installed and properly configured for UserFrosting. |
4 | | -obsolete: true |
| 4 | +outdated: true |
5 | 5 | --- |
6 | | -<!-- [plugin:content-inject](/modular/_updateRequired) --> |
7 | 6 |
|
8 | | -> [!NOTE] |
9 | | -> This page needs updating. To contribute to this documentation, please submit a pull request to our [learn repository](https://github.com/userfrosting/learn/tree/master/pages). |
| 7 | +We recommend starting with a 1GB+ memory VPS and installing a LEMP stack (Ubuntu 24.04 LTS, nginx, MariaDB, and PHP 8.1+). You can use a pre-configured [one-click LEMP stack](https://marketplace.digitalocean.com/apps/lemp) or manually install the components. While Apache is also supported, nginx offers superior performance and requires less configuration. |
10 | 8 |
|
11 | | -We recommend that you start with a $4/month Droplet and [install a LEMP stack](https://marketplace.digitalocean.com/apps/lemp) (Ubuntu 20.04, nginx, MariaDB, and PHP 8.1). If you prefer you may [install Apache instead](https://marketplace.digitalocean.com/apps/lamp), but nginx offers superior performance and requires less configuration. |
| 9 | +> [!NOTE] |
| 10 | +> UserFrosting requires PHP 8.1 or higher. Make sure your server stack includes a compatible PHP version. |
12 | 11 |
|
13 | | -When you go to create your Droplet, DigitalOcean will ask you some initial configuration questions. Choose Ubuntu 22.04 as your distribution, and select a datacenter that is nearest to you and your customers. **Do NOT set up SSH keys at this time** - if you do, DigitalOcean won't email you a root user password. We will set up SSH later, after we've logged in with a password first. |
| 12 | +When creating your VPS, select **Ubuntu 24.04 LTS** (or 22.04 LTS) as your distribution, and choose a datacenter that is geographically close to you and your users for optimal latency. **Do NOT set up SSH keys at this time** - if you do, DigitalOcean won't email you a root user password. We will set up SSH later, after we've logged in with a password first. |
14 | 13 |
|
15 | 14 | From here, you can follow DigitalOcean's tutorials to set up your server: |
16 | 15 |
|
17 | | -## Initial Server Setup with Ubuntu 22.04 |
| 16 | +## Initial Server Setup with Ubuntu |
18 | 17 |
|
19 | | -First, follow [**this tutorial**](https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-22-04). |
| 18 | +Follow [**this tutorial for Ubuntu 24.04**](hhttps://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu) or [Ubuntu 22.04](https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-22-04). |
20 | 19 |
|
21 | | -Some notes: |
| 20 | +Key configuration steps: |
| 21 | + |
| 22 | +1. **SSH Keys**: On Windows, use [Windows Terminal](https://aka.ms/terminal) or [PuTTY](https://www.putty.org/) to generate SSH keys. Modern Windows includes OpenSSH by default. |
| 23 | + |
| 24 | +2. **User Groups**: Add your non-root user to the `www-data` group so both your account and the webserver can access application files: |
| 25 | + ```bash |
| 26 | + sudo usermod -a -G www-data <your-username> |
| 27 | + ``` |
22 | 28 |
|
23 | | -1. On Windows, you may find it easier to generate an SSH key in Putty and manually copy it to the `authorized_keys` file on your Droplet. |
24 | | -2. When you create your non-root user account in Ubuntu, we recommend adding them to the `www-data` group, which is the group to which your webserver belongs. That way, you can set the group owner of your UserFrosting application files to `www-data`, and both your account _and_ the webserver account will have ownership. To do this, do `sudo usermod -a -G www-data alex`, replacing `alex` with your user account name. |
25 | | -3. Their instructions for the `ufw` firewall only have you open up the `ssh` port by default. Obviously for a web server, you will also need to open up ports 80 or `http` and/or 443 or `https`. See [this guide](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-20-04#step-5-allowing-other-connections) for help opening up additional ports. DigitalOcean also provides a [cloud firewall](https://docs.digitalocean.com/products/networking/firewalls/) which can be set up through the dashboard, rather than the commandline. |
26 | | -4. For additional security, you may also want to disable root login via SSH by setting `PermitRootLogin` to `no` in your `/etc/ssh/sshd_config` file. |
| 29 | +3. **Firewall Configuration**: Configure `ufw` to allow web traffic: |
| 30 | + ```bash |
| 31 | + sudo ufw allow 'Nginx Full' # Allows both HTTP (80) and HTTPS (443) |
| 32 | + sudo ufw allow OpenSSH |
| 33 | + sudo ufw enable |
| 34 | + ``` |
| 35 | + |
| 36 | + Alternatively, use your hosting provider's cloud firewall dashboard. |
| 37 | + |
| 38 | +4. **Disable Root Login**: For security, set `PermitRootLogin no` in `/etc/ssh/sshd_config` and reload SSH: |
| 39 | + ```bash |
| 40 | + sudo systemctl reload sshd |
| 41 | + ``` |
27 | 42 |
|
28 | 43 | ## Additional server configuration |
29 | 44 |
|
30 | | -### Set your server's **timezone** |
| 45 | +### Set your server's timezone |
| 46 | + |
| 47 | +Configure your server to use the correct timezone: |
| 48 | + |
| 49 | +```bash |
| 50 | +sudo timedatectl set-timezone America/New_York # Replace with your timezone |
| 51 | +timedatectl # Verify the change |
| 52 | +``` |
31 | 53 |
|
32 | | -See [**this guide from DigitalOcean**](https://www.digitalocean.com/community/tutorials/how-to-set-up-time-synchronization-on-ubuntu-22-04). |
| 54 | +For more details, see [**this DigitalOcean guide**](https://www.digitalocean.com/community/tutorials/how-to-set-up-time-synchronization-on-ubuntu-22-04). |
33 | 55 |
|
34 | 56 | ### Configure the `nano` command-line editor to convert tabs to spaces |
35 | 57 |
|
|
0 commit comments