sudo apt-get install nginx -y<\/pre>\nOnce installed, start and enable the service.<\/p>\n
sudo systemctl enable nginx.service && sudo systemctl start nginx.service<\/pre>\nCheck if the service is up and running:<\/p>\n
sudo systemctl status nginx.service<\/pre>\nYou should receive the following output:<\/p>\n
root@host:~# sudo systemctl status nginx.service\r\n\u25cf nginx.service - A high performance web server and a reverse proxy server\r\n Loaded: loaded (\/lib\/systemd\/system\/nginx.service; enabled; vendor preset: enabled)\r\n Active: active (running) since Tue 2022-06-28 20:42:37 UTC; 2s ago\r\n Docs: man:nginx(8)\r\n Process: 129015 ExecStartPre=\/usr\/sbin\/nginx -t -q -g daemon on; master_process on; (code=exited, status=0\/SUCCESS)\r\n Process: 129016 ExecStart=\/usr\/sbin\/nginx -g daemon on; master_process on; (code=exited, status=0\/SUCCESS)\r\n Main PID: 129017 (nginx)\r\n Tasks: 5 (limit: 4579)\r\n Memory: 4.8M\r\n CPU: 353ms\r\n CGroup: \/system.slice\/nginx.service\r\n \u251c\u2500129017 \"nginx: master process \/usr\/sbin\/nginx -g daemon on; master_process on;\"\r\n \u251c\u2500129018 \"nginx: worker process\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\r\n \u251c\u2500129019 \"nginx: worker process\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\r\n \u251c\u2500129020 \"nginx: worker process\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\r\n \u2514\u2500129021 \"nginx: worker process\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\r\n\r\nJun 28 20:42:37 host.test.vps systemd[1]: Starting A high performance web server and a reverse proxy server...\r\nJun 28 20:42:37 host.test.vps systemd[1]: Started A high performance web server and a reverse proxy server.\r\n<\/pre>\n<\/span>Step 3. Install PHP with extensions<\/span><\/h2>\nTo install PHP8.1 with extensions, execute the following commands:<\/p>\n
sudo apt-get install php8.1 php8.1-fpm php8.1-cli php8.1-common php8.1-imap php8.1-redis php8.1-snmp php8.1-xml php8.1-zip php8.1-mbstring php8.1-curl\r\n<\/pre>\nOnce the PHP extensions are installed, we need to check if the PHP-FPM service is up and running with the command below:<\/p>\n
sudo systemctl status php8.1-fpm.service<\/pre>\nIf the service is up and running, you should receive the following output:<\/p>\n
root@host:~# sudo systemctl status php8.1-fpm.service\r\n\u25cf php8.1-fpm.service - The PHP 8.1 FastCGI Process Manager\r\n Loaded: loaded (\/lib\/systemd\/system\/php8.1-fpm.service; enabled; vendor preset: enabled)\r\n Active: active (running) since Tue 2022-06-28 20:44:59 UTC; 15min ago\r\n Docs: man:php-fpm8.1(8)\r\n Process: 130885 ExecStartPost=\/usr\/lib\/php\/php-fpm-socket-helper install \/run\/php\/php-fpm.sock \/etc\/php\/8.1\/fpm\/pool.d\/www.conf 81 (code=exited, status=0\/SUCCESS)\r\n Main PID: 130881 (php-fpm8.1)\r\n Status: \"Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req\/sec\"\r\n Tasks: 3 (limit: 4579)\r\n Memory: 10.6M\r\n CPU: 760ms\r\n CGroup: \/system.slice\/php8.1-fpm.service\r\n \u251c\u2500130881 \"php-fpm: master process (\/etc\/php\/8.1\/fpm\/php-fpm.conf)\r\n<\/pre>\n