Linux command
a2ensite 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Enable
sudo a2ensite [virtual_host]
Enable multiple
sudo a2ensite [site1] [site2]
Enable the default
sudo a2ensite 000-default
Example
sudo a2ensite -q [virtual_host]
Reload
sudo systemctl reload apache2
说明
a2ensite is a Debian-specific utility that enables Apache2 virtual host configurations by creating symbolic links in /etc/apache2/sites-enabled pointing to site files in /etc/apache2/sites-available. The first virtual host handles unmatched requests, so it should be named 000-default to ensure it loads first alphabetically. The tool works alongside a2dissite, which disables sites.
参数
- -q, --quiet
- Don't show informative messages
- -m, --maintmode
- Enables maintainer mode; the program invocation is effectuated automatically by a maintainer script. Not intended for end users.
FAQ
What is the a2ensite command used for?
a2ensite is a Debian-specific utility that enables Apache2 virtual host configurations by creating symbolic links in /etc/apache2/sites-enabled pointing to site files in /etc/apache2/sites-available. The first virtual host handles unmatched requests, so it should be named 000-default to ensure it loads first alphabetically. The tool works alongside a2dissite, which disables sites.
How do I run a basic a2ensite example?
Run `sudo a2ensite [virtual_host]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -q, --quiet do in a2ensite?
Don't show informative messages