Categories
Projects

How to host Multiple Web Pages using one server with Apache

In tonight’s tutorial, VE will show you how to host multiple web pages using a single Apache server.

First we need to start out by setting up an Apache server. We are going to do this in an LXC in Proxmox, but you can follow this tutorial on bear metal servers as well, just skip over the part of setting up the LXC in Proxmox.

To do this and to make it easer to skip over, we are going to follow a video that VE already has on making a container:

Now that we have a system or LXC with Ubuntu 21.04 installed we can start installing Apache by updating Ubuntu and while we are doing that, why not just install the updates as well? We can do that by running the following command:

$ sudo apt update && sudo apt upgrade -y

With the system updated and the updates installed, it is time to install Apache using the command:

$ sudo apt install apache2

At this point you might want to create a new user. You don’t need to do this but it is a good idea.

$ adduser [username]

Now add this user to sudo:

$ adduser [username] sudo

Reboot the server:

$ reboot

login with the new user:

Now that you are logged in to your new user account, it is time to turn off the root user. To do this run the command:

$ sudo passwd -l root

So with the new user and Apache installed, it is time to start setting up the two websites. To do this we first need to make the directories for the two sites using the following commands:

$ mkdir -p /var/www/[domain name 1].local/html

$ mkdir -p /var/www/[domain name 2].local/html

With the folders made that will how the two pages lets spend some time and make the two pages

Page 1

<!DOCTYPE html>
<html>
<body>
    <h1>Welcome to Web Page one</h1>
    <p>This is your first page thank you for fallowing this tutorial</p>
</body>
</html>

Page 2

<!DOCTYPE html>
<html>
<body>
    <h1>Welcome to Web Page two</h1>
    <p>This is your second page thank you for fallowing this tutorial</p>
</body>

With the two pages made, it is time to make the config file that Apache will need to serve up the two pages. The first this that we will have to do the make this happen is move directory that will hold the config file. We can do this by entering the command:

$ cd /etc/apache2/sites-available

In the sites-available folder we need to make 2 config files to tell Apache how we would like it to work with the ..html files that we made in the previous step. To do this we will start by entering the command:

$ sudo nano [domain name 1].conf

Inside of the nano text editor enter the lines

<VirtualHost *:80>
    ServerName [domain name 1].local
    DocumentRoot /var/www/[domain name 1].local/html
</VirtualHost>

press control + x save and exit then enter the command:

$ sudo nano [domain name 2].conf

Inside of the nano text editor enter the lines:

<VirtualHost *:80>
    ServerName [domain name 2].local
    DocumentRoot /var/www/[domain name 2].local/html
</VirtualHost>

Now it is time to tell Apache about the config files that we have made so that it will use them to host both pages. We will do that will the commands

$ a2ensite [domain name 1].conf

$ a2ensite [domain name 2].conf

Now that you have told Apache the start using the config files, reload Apache so that It will use them.

$ systemctl reload apache2

The last step is to configure you DNS settings to point to the IP address of the server.

Categories
Proxmox

Add SMB Share Using Just Web Interface Proxmox 7

To night we are going to look at how to add a SMB share to Proxmox 7 using just the web interface.

The first this that you are going to want to do after entering your Proxmox web interface is to go to Datacenter.

After you are in Datacenter, you will select storage.

Now that you are in storage tab of Datacenter it is time to click add and select SMB/CIFS to start adding your samba server to the Proxmox 7 web interface.

You are going to have to fill out some fields inside of this tab the first one is ID this is that name that would like to call this drive in the web interface. the next one is server this is the IP of your server, Username is the username for your server login, password is the password for the server login. the last one on the left is Share this will be the shared folder that you have setup in your SMB server config file. The on the right you will need to tell Proxmox what you are doing with the server in the Content drop down.

After you have filled out all the fields in the add SMB/CIFS tab it is time to click ADD and you should see the new drive appear in the Server View window.