Configure the virtual host domain name under the Linux environment
The first step:
Under the root directory (that is, the root directory)
LS (view file)
CD into etc directory
Find Hosts File
VI hosts open the Hosts file and edit it
At the bottom of the open file, add:
192.168.8.115 domain.com.cn
Step Two:
cd/usr/local/apache2/conf/Enter the directory below
LS View all files and directories under the current directory
VI httpd.conf Open and edit this file
Edit: Use PgDn on your keyboard to pull the cursor to the lowest end, and then add the following code:
Namevirtualhost 192.168.1.115: 80
<virtualhost 192.168.1.115:80>
DocumentRoot /usr/local/apache2/htdocs/project
ServerName domain.com.cn
</VirtualHost>
<directory "/usr/local/apache2/htdocs/project" >
Options Indexes FollowSymLinks
AllowOverride All
Order Deny,allow
Deny from all
Allow from all
</Directory>
Step Three:
Because there is no browser under Linux, even if you have all the configuration, in the end, we still have to go back to Windows. It is accessed by a browser.
So, finally, the most critical one
Open the Hosts file under the C:\WINDOWS\system32\drivers\etc directory
Add a 192.168.1.115 domain.com.cn and then. ok!~
I am configuring Host2, which is 192.168.8.202, namely:
Verify that:
Get!
Configuring the virtual host domain name in a Linux environment