Qcbt di ubuntu 22

From Wiki Musakarta

To set up an Nginx server with a maximum upload size of 215 MB, MariaDB, and PHP 5 with all extensions on Ubuntu 22.04, you can follow these steps. Additionally, we will configure Nginx to serve a website on any IP and install Webmin for easy server management.

1. **Update System Packages:**

   ```bash
   sudo apt update
   sudo apt upgrade -y
   ```

2. **Install Nginx:**

   ```bash
   sudo apt install nginx -y
   ```

3. **Configure Nginx for Maximum Upload Size:**

   Open the Nginx configuration file:
   ```bash
   sudo nano /etc/nginx/nginx.conf
   ```
   Add the following line inside the `http` block:
   ```nginx
   client_max_body_size 215M;
   ```
   Save and close the file, then restart Nginx:
   ```bash
   sudo systemctl restart nginx
   ```

4. **Install MariaDB:**

   ```bash
   sudo apt install mariadb-server mariadb-client -y
   ```
   Secure the installation:
   ```bash
   sudo mysql_secure_installation
   ```

5. **Install PHP 5:**

   Since PHP 5 is outdated and not available in the default repositories for Ubuntu 22.04, you need to use a PPA or manually compile it. Here we'll use a PPA:
   Add the repository:
   ```bash
   sudo add-apt-repository ppa:ondrej/php
   sudo apt update
   ```
   Install PHP 5.6 (latest PHP 5 version available from the PPA):
   ```bash
   sudo apt install php5.6 php5.6-fpm php5.6-mysql php5.6-cli php5.6-common php5.6-curl php5.6-gd php5.6-intl php5.6-json php5.6-mbstring php5.6-xml php5.6-zip php5.6-soap php5.6-bcmath -y
   ```

6. **Configure Nginx to Use PHP:**

   Create a new server block configuration file for your website:
   ```bash
   sudo nano /etc/nginx/sites-available/your_website
   ```
   Add the following configuration (replace `your_website` with your actual domain or server name):
   ```nginx
   server {
       listen 80;
       server_name your_website;
       root /var/www/your_website;
       index index.php index.html index.htm;
       location / {
           try_files $uri $uri/ =404;
       }
       location ~ \.php$ {
           include snippets/fastcgi-php.conf;
           fastcgi_pass unix:/run/php/php5.6-fpm.sock;
       }
       location ~ /\.ht {
           deny all;
       }
   }
   ```
   Enable the configuration:
   ```bash
   sudo ln -s /etc/nginx/sites-available/your_website /etc/nginx/sites-enabled/
   ```
   Test the configuration and restart Nginx:
   ```bash
   sudo nginx -t
   sudo systemctl restart nginx
   ```

7. **Install Webmin:**

   Add the Webmin repository:
   ```bash
   sudo nano /etc/apt/sources.list
   ```
   Add this line to the end of the file:
   ```
   deb http://download.webmin.com/download/repository sarge contrib
   ```
   Add the Webmin GPG key:
   ```bash
   wget http://www.webmin.com/jcameron-key.asc
   sudo apt-key add jcameron-key.asc
   ```
   Install Webmin:
   ```bash
   sudo apt update
   sudo apt install webmin -y
   ```

8. **Access Webmin:**

   Webmin should be accessible via `https://your_server_ip:10000`. You can log in with your system's root user and password.

By following these steps, you should have a fully configured Nginx server with PHP 5, MariaDB, and Webmin on Ubuntu 22.04, capable of handling large file uploads up to 215 MB.