Notes on LEMP stacked on ubuntuless. How to's, etc.
sudo apt install nginx
#test with curl, output is html page
curl http://localhost or curl http://vaagrant-vm-ip
sudo apt install mysql-server
sudo mysql
#set mysql root password to Mysqlroot123!
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Mysqlroot123!';
exit;
sudo apt install php libapache2-mod-php php-mysql
#test php engine
php -v
sudo mkdir /var/www/newdomain
sudo chown -R $USER:$USER /var/www/newdomain
sudo nano /etc/nginx/sites-available/newdomain
server { listen 80; server_name newdomain www.newdomain; root /var/www/newdomain; index index.html index.htm index.php;
location / { try_files $uri $uri/ =404; }
location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.1-fpm.sock; }
location ~ /\.ht { deny all; } }
sudo ln -s /etc/nginx/sites-available/newdomain /etc/nginx/sites-enabled/
sudo unlink /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl reload nginx
nano /var/www/newdomain/index.html
<html> <head> <title>newdomain website</title> </head>
<body> <h1>Hello World!</h1>
<p>This is the landing page of <strong>newdomain</strong>.</p>
</body>
</html>
#test with curl or browser, output is html page
curl http://localhost or curl http://vaagrant-vm-ip
Test this box with different PHP frameworks and applications. Happy Provisioning!
Learn to manage multiple domains/projects at the link below: