Hi! So its great that Digital Ocean offers Rocky Linux as a base install for a vps! Whenever I install a lemp stack (from command line only) the default website seems to work fine. Any time i try to install multiple sites it does not seem to work - probably some sort of nginx config error? It is very easy to install lemp stack via command line from ubuntu, Rocky is a bit different of course. NONE of websites offering tutorials seem to work tho for a rocky vps (lemp) with multiple domains.
Here are the commands I use- the multiple domains do not resolve tho.
///////////////////
sudo dnf update -y
adduser a2
passwd a2
a2a0hedYRsA8cd94BHnhf38L96h9heu7er7BfqShsYnhpqka
usermod -aG wheel a2
//////////////////////////////////////////////
Check the sudoers file with
visudo
////////////////////////////////////////////////
dnf install nginx
sudo systemctl enable nginx
sudo systemctl start nginx
/////////////////////////////////////////////////////////////
sudo dnf -y install @mariadb
$ sudo systemctl enable mariadb
$ sudo systemctl start mariadb
mysql_secure_installation
a2a0hhpqkaSnA8cd94BHnhfjhpnD5438L96h9heu7edYRser7BfqShsYnT%cDgtc4w19hfeiuoYrlqhp
//////////////////////////////////////////////////////
dnf install epel-release -y
dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
dnf module list php
dnf module reset php
dnf module enable php:remi-8.1
dnf install php php-cli php-mysqlnd php-gd php-curl php-sqlite3 -y
php -v
sudo dnf install php-fpm
sudo systemctl enable --now php-fpm
///////////////
This is the default index.html page that is distributed with nginx on Rocky Linux. It is located in /usr/share/nginx/html.
You should now put your content in a location of your choice and edit the root configuration directive in the nginx configuration file /etc/nginx/nginx.conf.
//////////////////////////////////////////
sudo mkdir -p /var/www/example.com/html
sudo mkdir -p /var/www/example.net/html
sudo mkdir -p /var/www/example.org/html
sudo chown -R $USER:$USER /var/www/example.com/html
sudo chown -R $USER:$USER /var/www/example.net/html
sudo chown -R $USER:$USER /var/www/example.org/html
sudo chmod -R 755 /var/www
sudo nano /var/www/example.com/html/index.html
sudo nano /var/www/example.net/html/index.html
sudo nano /var/www/example.org/html/index.html
sudo mkdir /etc/nginx/sites-available
sudo mkdir /etc/nginx/sites-enabled
////////////////////////////////////
sudo nano /etc/nginx/nginx.conf
Paste the following lines. The first line specifies the path to the directory containing additional configuration files. The second line increases the memory allocated to parsing domain names.
include /etc/nginx/sites-enabled/*.conf;
server_names_hash_bucket_size 64;
sudo nano /etc/nginx/sites-available/example.org.conf
server {
listen 80;
server_name example.org www.example.org;
location / {
root /var/www/example.org/html;
index index.html index.htm index.php;
try_files $uri $uri/ =404;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
sudo ln -s /etc/nginx/sites-available/example.com.conf /etc/nginx/sites-enabled/example.com.conf
sudo ln -s /etc/nginx/sites-available/example.net.conf /etc/nginx/sites-enabled/example.net.conf
sudo ln -s /etc/nginx/sites-available/example.org.conf /etc/nginx/sites-enabled/example.org.conf
sudo systemctl restart nginx