enable-apache2-modules

The commmand used to enable or disable apache modules is :

Enable:

 a2enmod rewrite vhost_alias

List for enable:

looser@looserbox:~$ a2enmod
Your choices are: access_compat actions alias allowmethods asis auth_basic auth_digest auth_form authn_anon authn_core authn_dbd authn_dbm authn_file authn_socache authnz_fcgi authnz_ldap authz_core authz_dbd authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex buffer cache cache_disk cache_socache cern_meta cgi cgid charset_lite data dav dav_fs dav_lock dbd deflate dialup dir dump_io echo env expires ext_filter file_cache filter headers heartbeat heartmonitor http2 ident imagemap include info lbmethod_bybusyness lbmethod_byrequests lbmethod_bytraffic lbmethod_heartbeat ldap log_debug log_forensic lua macro mime mime_magic mpm_event mpm_prefork mpm_worker negotiation php7.2 proxy proxy_ajp proxy_balancer proxy_connect proxy_express proxy_fcgi proxy_fdpass proxy_ftp proxy_hcheck proxy_html proxy_http proxy_http2 proxy_scgi proxy_wstunnel ratelimit reflector remoteip reqtimeout request rewrite sed session session_cookie session_crypto session_dbd setenvif slotmem_plain slotmem_shm socache_dbm socache_memcache socache_shmcb speling ssl status substitute suexec unique_id userdir usertrack vhost_alias xml2enc
Which module(s) do you want to enable (wildcards ok)?

List for disable:

looser@looserbox:~$ a2dismod
Your choices are: access_compat alias auth_basic authn_core authn_file authz_core authz_host authz_user autoindex deflate dir env filter mime mpm_prefork negotiation php7.2 reqtimeout rewrite setenvif status vhost_alias
Which module(s) do you want to disable (wildcards ok)?
looser@looserbox:~$ a2dismod rewrite vhost_alias
Could not remove /etc/apache2/mods-enabled/rewrite.load: Permission denied
looser@looserbox:~$ sudo a2dismod rewrite vhost_alias
[sudo] contraseƱa para looser:
Module rewrite disabled.
Module vhost_alias disabled.
To activate the new configuration, you need to run:
  systemctl restart apache2
looser@looserbox:~$

Enable sites:

$ sudo a2ensite test.com.conf  #Create symlink in sites-enabled to test.com.conf in sites-available
$ sudo service apache2 reload #Reload apache config so it's aware of new virtual host

Disable sites:

$ sudo a2dissite test.com.conf  #Remove symlink
$ sudo service apache2 reload