How to Set Up an Apache Virtual Host on a Local LAMP Server
Setting up a virtual host on a local LAMP stack requires creating an Apache configuration file under /etc/apache2/sites-available/ with directives such as ServerName, DocumentRoot, and Directory permissions. Once the config file is saved, the site must be enabled using the a2ensite command, followed by reloading the Apache service via systemctl. The local domain, such as example.sandbox, must then be mapped to 127.0.0.1 by editing the system's /etc/hosts file. A corresponding web root directory should be created under /var/www/ and ownership assigned to the current user and the www-data group. After these steps, the virtual host becomes accessible through a browser at the configured local domain.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in