$ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update && -weight: 600;">sudo -weight: 500;">apt -weight: 500;">upgrade -y
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">update && -weight: 600;">sudo -weight: 500;">apt -weight: 500;">upgrade -y
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">update && -weight: 600;">sudo -weight: 500;">apt -weight: 500;">upgrade -y
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install nginx -y
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install nginx -y
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install nginx -y
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status nginx
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status nginx
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status nginx
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install mariadb-server -y
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install mariadb-server -y
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install mariadb-server -y
-weight: 600;">sudo mysql_secure_installation
-weight: 600;">sudo mysql_secure_installation
-weight: 600;">sudo mysql_secure_installation
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install php-fpm php-mysql php-mbstring php-xml php--weight: 500;">curl -y
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install php-fpm php-mysql php-mbstring php-xml php--weight: 500;">curl -y
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install php-fpm php-mysql php-mbstring php-xml php--weight: 500;">curl -y
-weight: 600;">sudo mkdir -p /var/www/website1.com/public_html
-weight: 600;">sudo mkdir -p /var/www/website2.com/public_html
-weight: 600;">sudo mkdir -p /var/www/website1.com/public_html
-weight: 600;">sudo mkdir -p /var/www/website2.com/public_html
-weight: 600;">sudo mkdir -p /var/www/website1.com/public_html
-weight: 600;">sudo mkdir -p /var/www/website2.com/public_html
-weight: 600;">sudo chown -R your_user:www-data /var/www/website1.com
-weight: 600;">sudo chown -R your_user:www-data /var/www/website2.com
-weight: 600;">sudo chmod -R 755 /var/www/website1.com
-weight: 600;">sudo chmod -R 755 /var/www/website2.com
-weight: 600;">sudo chown -R your_user:www-data /var/www/website1.com
-weight: 600;">sudo chown -R your_user:www-data /var/www/website2.com
-weight: 600;">sudo chmod -R 755 /var/www/website1.com
-weight: 600;">sudo chmod -R 755 /var/www/website2.com
-weight: 600;">sudo chown -R your_user:www-data /var/www/website1.com
-weight: 600;">sudo chown -R your_user:www-data /var/www/website2.com
-weight: 600;">sudo chmod -R 755 /var/www/website1.com
-weight: 600;">sudo chmod -R 755 /var/www/website2.com
-weight: 600;">sudo nano /var/www/website1.com/public_html/index.html
-weight: 600;">sudo nano /var/www/website1.com/public_html/index.html
-weight: 600;">sudo nano /var/www/website1.com/public_html/index.html
<!DOCTYPE html>
<html>
<head> <title>Welcome to website1.com!</title>
</head>
<body> <h1>Success! The website1.com server block is working!</h1>
</body>
</html>
<!DOCTYPE html>
<html>
<head> <title>Welcome to website1.com!</title>
</head>
<body> <h1>Success! The website1.com server block is working!</h1>
</body>
</html>
<!DOCTYPE html>
<html>
<head> <title>Welcome to website1.com!</title>
</head>
<body> <h1>Success! The website1.com server block is working!</h1>
</body>
</html>
-weight: 600;">sudo nano /var/www/website2.com/public_html/index.html
-weight: 600;">sudo nano /var/www/website2.com/public_html/index.html
-weight: 600;">sudo nano /var/www/website2.com/public_html/index.html
<!DOCTYPE html>
<html>
<head> <title>Welcome to website2.com!</title>
</head>
<body> <h1>Success! The website2.com server block is working!</h1>
</body>
</html>
<!DOCTYPE html>
<html>
<head> <title>Welcome to website2.com!</title>
</head>
<body> <h1>Success! The website2.com server block is working!</h1>
</body>
</html>
<!DOCTYPE html>
<html>
<head> <title>Welcome to website2.com!</title>
</head>
<body> <h1>Success! The website2.com server block is working!</h1>
</body>
</html>
-weight: 600;">sudo nano /etc/nginx/sites-available/website1.com
-weight: 600;">sudo nano /etc/nginx/sites-available/website1.com
-weight: 600;">sudo nano /etc/nginx/sites-available/website1.com
server { listen 80; listen [::]:80; server_name website1.com www.website1.com; root /var/www/website1.com/public_html; index index.html index.htm index.nginx-debian.html; location / { try_files $uri $uri/ =404; } # Pass PHP scripts to FastCGI server location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.1-fpm.sock; # Adjust PHP version if necessary fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # Deny access to .htaccess files, if Apache's document root # concurs with nginx's one location ~ /\.ht { deny all; }
}
server { listen 80; listen [::]:80; server_name website1.com www.website1.com; root /var/www/website1.com/public_html; index index.html index.htm index.nginx-debian.html; location / { try_files $uri $uri/ =404; } # Pass PHP scripts to FastCGI server location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.1-fpm.sock; # Adjust PHP version if necessary fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # Deny access to .htaccess files, if Apache's document root # concurs with nginx's one location ~ /\.ht { deny all; }
}
server { listen 80; listen [::]:80; server_name website1.com www.website1.com; root /var/www/website1.com/public_html; index index.html index.htm index.nginx-debian.html; location / { try_files $uri $uri/ =404; } # Pass PHP scripts to FastCGI server location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.1-fpm.sock; # Adjust PHP version if necessary fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # Deny access to .htaccess files, if Apache's document root # concurs with nginx's one location ~ /\.ht { deny all; }
}
-weight: 600;">sudo nano /etc/nginx/sites-available/website2.com
-weight: 600;">sudo nano /etc/nginx/sites-available/website2.com
-weight: 600;">sudo nano /etc/nginx/sites-available/website2.com
server { listen 80; listen [::]:80; server_name website2.com www.website2.com; root /var/www/website2.com/public_html; index index.html index.htm index.nginx-debian.html; location / { try_files $uri $uri/ =404; } # Pass PHP scripts to FastCGI server location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.1-fpm.sock; # Adjust PHP version if necessary fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # Deny access to .htaccess files, if Apache's document root # concurs with nginx's one location ~ /\.ht { deny all; }
}
server { listen 80; listen [::]:80; server_name website2.com www.website2.com; root /var/www/website2.com/public_html; index index.html index.htm index.nginx-debian.html; location / { try_files $uri $uri/ =404; } # Pass PHP scripts to FastCGI server location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.1-fpm.sock; # Adjust PHP version if necessary fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # Deny access to .htaccess files, if Apache's document root # concurs with nginx's one location ~ /\.ht { deny all; }
}
server { listen 80; listen [::]:80; server_name website2.com www.website2.com; root /var/www/website2.com/public_html; index index.html index.htm index.nginx-debian.html; location / { try_files $uri $uri/ =404; } # Pass PHP scripts to FastCGI server location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.1-fpm.sock; # Adjust PHP version if necessary fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # Deny access to .htaccess files, if Apache's document root # concurs with nginx's one location ~ /\.ht { deny all; }
}
-weight: 600;">sudo ln -s /etc/nginx/sites-available/website1.com /etc/nginx/sites-enabled/
-weight: 600;">sudo ln -s /etc/nginx/sites-available/website2.com /etc/nginx/sites-enabled/
-weight: 600;">sudo ln -s /etc/nginx/sites-available/website1.com /etc/nginx/sites-enabled/
-weight: 600;">sudo ln -s /etc/nginx/sites-available/website2.com /etc/nginx/sites-enabled/
-weight: 600;">sudo ln -s /etc/nginx/sites-available/website1.com /etc/nginx/sites-enabled/
-weight: 600;">sudo ln -s /etc/nginx/sites-available/website2.com /etc/nginx/sites-enabled/
-weight: 600;">sudo nginx -t
-weight: 600;">sudo nginx -t
-weight: 600;">sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
-weight: 600;">sudo -weight: 500;">systemctl reload nginx
-weight: 600;">sudo -weight: 500;">systemctl reload nginx
-weight: 600;">sudo -weight: 500;">systemctl reload nginx
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install certbot python3-certbot-nginx -y
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install certbot python3-certbot-nginx -y
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install certbot python3-certbot-nginx -y
-weight: 600;">sudo certbot --nginx -d website1.com -d www.website1.com -d website2.com -d www.website2.com
-weight: 600;">sudo certbot --nginx -d website1.com -d www.website1.com -d website2.com -d www.website2.com
-weight: 600;">sudo certbot --nginx -d website1.com -d www.website1.com -d website2.com -d www.website2.com
-weight: 600;">sudo certbot renew --dry-run
-weight: 600;">sudo certbot renew --dry-run
-weight: 600;">sudo certbot renew --dry-run
-weight: 600;">sudo mysql -u root -p
-weight: 600;">sudo mysql -u root -p
-weight: 600;">sudo mysql -u root -p
sql
CREATE DATABASE website1_db;
CREATE USER 'website1_user'@'localhost' IDENTIFIED BY 'your_strong_
sql
CREATE DATABASE website1_db;
CREATE USER 'website1_user'@'localhost' IDENTIFIED BY 'your_strong_
sql
CREATE DATABASE website1_db;
CREATE USER 'website1_user'@'localhost' IDENTIFIED BY 'your_strong_ - Linux: The operating system. Most VPS providers offer various Linux distributions like Ubuntu, CentOS, or Debian. We'll assume you're using a popular choice like Ubuntu.
- Apache or Nginx: The web server. This software is responsible for receiving requests from visitors' browsers and sending back the website's content. Nginx is often favored for its performance and efficiency, especially with static content and high traffic. Apache is also very capable and widely used. For this guide, we'll use Nginx as it's a popular choice for modern VPS setups.
- MySQL/MariaDB: The database server. Websites often store data like user information, blog posts, or product details in a database. MySQL and its fork, MariaDB, are popular choices.
- PHP: The server-side scripting language. PHP is used to create dynamic web pages, interact with databases, and process user input. - php-fpm: FastCGI Process Manager, which is how Nginx communicates with PHP.
- php-mysql: Allows PHP to connect to MySQL/MariaDB databases.
- php-mbstring: Handles multi-byte strings, crucial for internationalization.
- php-xml: For working with XML data.
- php--weight: 500;">curl: For making HTTP requests from PHP.