Virtual Host Configuration in Ubuntu

Source: Internet
Author: User
A vm is a Web site running on a host. Each site has its own domain name. The VM is transparent to users, it is as if every site is running on a single host. If each Web site has a different IP address, it is called an IP-based virtual host. If the IP address of each site is the same but the domain name is different, it is called a virtual host based on the name or host name. The following shows how to configure a VM in Ubuntu: 1. Edit the/etc/hosts file and add the following content to the file: My IP Address

A vm is a Web site running on a host. Each site has its own domain name. The VM is transparent to users, it is as if every site is running on a single host.
If each Web site has a different IP address, it is called an IP-based virtual host. If the IP address of each site is the same but the domain name is different, it is called a virtual host based on the name or host name.

The following shows how to configure a virtual host in Ubuntu:
1. Edit the/etc/hosts file and add the following content to the file:
My IP address is 192.168.204.210, so the added content is:
192.168.204.210 www.Linuxidc.com
Then, you can run the ping command to test whether the command is correct? Ping 192.168.204.210. If the Ping succeeds, the domain name resolution is normal.
2. Create the required Directory: mkdir-p/var/www/Linuxidcb
3. Configure the/etc/apache2/sites-available/default file.
NameVirtualHost 192.168.204.210: 80
2
3 ServerAdmin www.Linuxidc.com
4
5 DocumentRoot/var/www/
6
7 Options FollowSymLinks
8 AllowOverride None
9
10
11 Options Indexes FollowSymLinks MultiViews
12 AllowOverride None
13 Order allow, deny
14 allow from all
15 # This directive allows us to have apache2's default start page
16 # in/apache2-default/, but still have/go to the right place
17 # RedirectMatch ^/$/apache2-default/
18
19
20 ScriptAlias/cgi-bin // usr/lib/cgi-bin/
21
22 AllowOverride None
23 Options ExecCGI-MultiViews + SymLinksIfOwnerMatch
24 Order allow, deny
25 Allow from all
26
27
28 ErrorLog/var/log/apache2/error. log
29
30 # Possible values include: debug, info, notice, warn, error, crit,
31 # alert, emerg.
32 LogLevel warn
33
34 mmlog/var/log/apache2/access. log combined
35 ServerSignature On
36
37 Alias/doc/"/usr/share/doc /"
38
39 Options Indexes MultiViews FollowSymLinks
40 AllowOverride None
41 Order deny, allow
42 Deny from all
43 Allow from 127.0.0.0/255.0.0.0: 1/128
44
45
46

Modify it to this.
4. Restart The Apache2 server. Enter/etc/init. d/apache2 restart in the command line.

5. Test the VM. Create an index.html file in the root directory of the virtual website, and enter http://www.linuxidc.com/in the browser. If you can see the content of index.html, the configuration is successful.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.