In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Ubuntu Apache Web server is what, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
Before giving you a detailed introduction to Apache, first let you know about Ubuntu Apache, and then a comprehensive introduction to Ubuntu Apache, I hope it will be useful to you. Ubuntu contains a very good translation and easy-to-use architecture, which will be continuously provided by the free software community and will make Ubuntu as easy for most people as possible. In general, we host multiple Web sites on the Web server, and each site has its own virtual server. For Ubuntu Apache, it supports both name-based virtual servers and IP-based servers.
For IP-based virtual servers, each site has a separate IP address, which has the disadvantage of using too many IP addresses, but now the IPv4 address is showing signs of exhaustion, so it is not recommended and is usually used only when SSL is required.
For name-based virtual servers, multiple Web sites share a single IP address. In this case, the HTTP request header is usually used to decide which site to send it to. To do this, we need to set up a separate configuration for each virtual server, naming the directory and host that is the root of the Web site. However, every time we add a new virtual server, we have to modify the configuration of Ubuntu Apache and restart it, which is really annoying!
Happily, if you use dynamic virtual hosting technology, you can join the virtual host at any time without having to reconfigure or start Ubuntu Apache. This technology uses a module called vhost_alias. We can enable the module by establishing a symbolic link in the Apache2-enabled module directory, as follows:
$sudo ln-s / etc/apache2/mods-available/vhost_alias.load\
/ etc/apache2/mods-enabled/vhost_alias.load for vhost_alias to work, we also need to modify / etc/apache2/apache2.conf to turn off the regular name (canonical names), modify the configuration of the log file, and specify a location for our virtual host. Here is an example:
# get the hostname from the "Host:" header
UseCanonicalName Off
# this log format can extract hostnames from * * fields
LogFormat "V h l u t" r "s b" vcommon
CustomLog / var/log/apache2/access_log vcommon
# include the hostname in the file name path that returns the request
VirtualDocumentRoot / var/www/vhosts/%0/web
VirtualScriptAlias / var/www/vhosts/%0/cgi-bin next, create a directory where the virtual host is stored, with the following command:
Create a new backbone virtual server for $sudo mkdir / var/www/vhosts with the following command:
$sudo mkdir-p / var/www/vhosts/skeleton/cgi-bin
$sudo cp-a / var/www/apache2-default / var/www/vhosts/skeleton/web restart apache2 to make the above configuration effective, as follows:
$sudo / etc/init.d/apache2 restart is good, now we can build a name-based virtual host. The method is to copy the backbone to the host name you want to respond to. For example, to create a new virtual server for www.mysite.com, simply run the following command:
$sudo cp-a / var/www/vhosts/skeleton / var/www/vhosts/
Now, in all HTTP connections to your Ubuntu Apache server, as long as its "Host:" header is set, it will be responded by the corresponding virtual server. In order to see the fruits of our labor earlier, we can test it locally. To edit / etc/hosts for this, add the following:
127.0.0.1 www. Mysite.com so that you can access the site on your local computer. However, in order for all users to access the virtual host, we also need to apply for a domain name, and we also need to set it on the public DNS server.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.