For actual project development, you may need different domains to point to different projects, then you need to configure the virtual host
The steps are as follows:
1. First, you need to go to the/etc/apache2/sites-available folder
Command:
Cd/etc/apache2/sites-available
, enter LS, you can see 000-default.conf this configuration file
2. Then, copy and rename the file, and enter the following:
sudo cp 000-default.conf new profile name. conf
For example:
1 sudo cp 000-default. conf index.conf
3. After the copy is finished, edit the file as follows:
sudo vim index.conf
After the modification, save and exit (for VIM related actions can be self-search, no longer described here)
Next, load the configuration file and do the following:
4. Registering a virtual host
sudo a2ensite index.conf
5. Re-execution:
6. Then restart the Apache server to
sudo service apache2 restart
Other:
/etc/apache2/sites-enabled (This is the virtual host you have registered)
Note: If you want to unregister, you can do
sudo a2dissite index.conf
After that, perform 5 or 6 operations
Ubuntu Configuration Virtual Host