UbuntuApach Virtual Host-Linux Enterprise Application-Linux server application information. The following is a detailed description. Target
1.
Create an IP-based Vm for overall testing of a project
2.
Create a user-based Vm for testing your code
Start
Create the directory structure of the VM
Sudo/home/www
Cd/home/www
Sudo mkdir 192.168.0.20.192.168.0.252
Cd 192.168.0.133
Sudo mkdir cgi-bin htdocs logs db
Cd ../192.168.0.252
Sudo mkdir cgi-bin htdocs logs db
Tree/home/www
/Home/www
| -- 192.168.0.20.
| -- Cgi-bin
| -- Db
| -- Htdocs
| '-- Logs
'-- 192.168.0.252
| -- Cgi-bin
| -- Db
| -- Htdocs
'-- Logs
1.
To create two IP-based virtual hosts on 192.168.0.252 and 192.168.0.252, the directories 192.168.0.20.and 192.168.0.252 are created under/home/www respectively.
2.
The cgi-bin subdirectory is used to store CGI scripts.
3.
The database subdirectory is used to store the SQLite database.
4.
The htdocs subdirectory is used to store site documents.
5.
The logs subdirectory is used to store site logs.
Create a VM management account and Set Directory Permissions
1.
Assign the administrator of the 192.168.0.20.vm to wuser1, assign the administrator of the 192.168.0.252 VM to wuser2, and allow them to log on through ssh.
2.
The master groups of wuser1 and wuser2 are both set to www-data. The convenience of this setting is: if the site contains the Apache process writeable content, you only need to add the group writeable permission.
Configure Virtual Network Interface and host name resolution
S2. use the default configuration to upload and download local users.
Samba Server
S1. use the following command
Sudo vi/etc/samba/smb. conf
Add the following configuration lines:
/Etc/samba/smb. conf
[Homes]
Comment = Home Directories
Browseable = no
Writable = yes
Create mask = 0644
Directory mask = 0755
S2. configure Samba users to add Samba users using the following command:
Sudo smbpasswd-a wuser1
Sudo smbpasswd-a wuser2
S3. start the Samba server
Sudo/etc/init. d/samba restart
Create a user-based VM
*
Developers may not have created a development environment on Windows clients.
*
To enable each developer to test their own code, they can create user-based virtual hosts.
1.
You need to create the public_html sub-directory under the Home Directory and put the Web document in it. You can use the URL http: // IPorHostname /~ Username
2.
For CGI development, you also need to create the cgi-bin subdirectory under the home directory.
Configure Apache
Use the following command to enable the userdir module:
Sudo a2enmod userdir
For CGI development, you need to modify/etc/apache2/mod-available/userdir. conf
ScriptAliasMatch ~ ([A-z] +)/cgi-bin/(. *)/home/$1/cgi-bin/$2
# Add this row, which means matching ~ User_name/cgi-bin/cgi_name automatically maps to the/home/user_name/cgi-bin/cgi-name script
About default Virtual Hosts
In Ubuntu, the file/etc/apache2/sites-available/default is configured with the default virtual host. The default root document directory of the VM is/var/www by default. To facilitate backup, it is best to store all the Web content in the/home/www directory, therefore, you can set the root document directory of the default VM to a subdirectory under/home/www by default.
Create the directory structure of the VM
Cd/home/www
Sudo mkdir 192.168.0.222
Cd 192.168.0.222
Sudo mkdir cgi-bin htdocs
Create a VM management account and Set Directory Permissions
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.