A vm is usually used to provide website services with multiple domain names on a single IP address. It is useful if someone wants to run multiple websites on a single IP address of a single VPS. In this tutorial, let me show you how to set up a VM on the Apache web server of Ubuntu14.04LTS. Note that this tutorial is only applicable to Ubuntu14.04 32-bit versions. I don't guarantee that it can also work in other lower Ubuntu versions or Ubuntu derivative versions (although the process may be similar ).
Virtual HostIt is often used to provide website services with multiple domain names on a single IP address. It is useful if someone wants to run multiple websites on a single IP address of a single VPS.
In this tutorial, let me show you how to set up a VM on the Apache web server of Ubuntu 14.04 LTS. Note that this tutorial is only applicable to Ubuntu14.04 32-bit versions.
I don't guarantee that it can also work in other lower Ubuntu versions or Ubuntu derivative versions (although the process may be similar ).
Solution
In this tutorial, I will use Ubuntu 14.04 32-bit LTS and build two test websites named"Unixmen1.localAndUnixmen2.local". My testing machines are192.168.1.250/24AndServer. unixmen. local. You can change the virtual domain name as needed.
Install Apache website Server
Before installing the apache server, update our Ubuntu Server:
- Sudo apt-get update
Then, run the following command to install the apache network server:
- Sudo apt-get install apache2
After installing the apache server, let's use this URLHttp: // ip address of your server/To test whether the website server works normally.
As you can see, the apache server is already working.
-------------------------------------- Split line --------------------------------------
Install the LAMP \ Vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04Http://www.linuxidc.com/Linux/2013-06/86250.htm
Compile and install LAMP (Apache 2.2.44 + MySQL 5.6.10 + PHP 5.4.12) http://www.linuxidc.com/Linux/2013-03/80333p3.htm in CentOS 5.9
Source code construction of Web Server Architecture in RedHat 5.4 LAMP environment and application PHPWind http://www.linuxidc.com/Linux/2012-10/72484p2.htm
LAMP source environment to build WEB Server Linux + Apache + MySQL + PHP http://www.linuxidc.com/Linux/2013-05/84882.htm
Build http://www.linuxidc.com/Linux/2014-05/101087.htm in LAMP + Xcache Environment
-------------------------------------- Split line --------------------------------------
Set VM 1. create virtual directory
Now, let's continue to install the VM. As I mentioned earlier, I want to create two new virtual hosts named"Unixmen1.localAndUnixmen2.local".
Create a public folder to store the data of the two virtual hosts.
First, let's create a directory for the unixmen1.local site:
- Sudo mkdir-p/var/www/unixmen1.local/public_html
Next, create a directory for the for unixmen2.local site:
- Sudo mkdir-p/var/www/unixmen2.local/public_html
2. Set the owner and permissions
The preceding directory only has root permissions. We need to modify the ownership of these two directories to common users, not just root users.
- Sudo chown-R $ USER: $ USER/var/www/unixmen1.local/public_html/
- Sudo chown-R $ USER: $ USER/var/www/unixmen2.local/public_html/
"$ USERThe variable points to the current login user.
Set the read and write permissions to the root directory (/var/www) and its subdirectories of the apache Web page, so that everyone can read files from the directory.
- Sudo chmod-R 755/var/www/
In this way, we have created some folders to save network-related data and assign necessary permissions and users.
4. Create a sample page for the VM
Now, we add a sample page to the website. Step 1: Let's give the VMUnixmen1.localCreate an Example page.
Create an Example page for the unixmen1.local VM,
- Sudo vi/var/www/unixmen1.local/public_html/index.html
Add the following content:
- Www. unixmen1.local
- Welcome To Unixmen1.local website
Save and close the file.
Similarly, add the sample page to the second VM.
- Sudo vi/var/www/unixmen2.local/public_html/index.html
Add the following content:
- Www. unixmen2.local
- Welcome To Unixmen2.local website
Save and close the file.
For more details, refer to the highlights on the next page.: Http://www.linuxidc.com/Linux/2014-06/102871p2.htm