Skip to content

Instantly share code, notes, and snippets.

@mroffice
Last active September 19, 2022 11:27
Show Gist options
  • Save mroffice/ead74a82d3e4f81a3ce5 to your computer and use it in GitHub Desktop.
Save mroffice/ead74a82d3e4f81a3ce5 to your computer and use it in GitHub Desktop.

Common Apache Commands and Features

Commands

Checks Syntax of Configuration Files

apachectl -t

Lists Loaded modules

apachectl -m

Lists Enabled Sites

apachectl -S

Starting, Stopping, Reloading, Restarting

sudo service apache2 start|stop|reload|restart

Enable/Disable Site, Enable/Disable Mod

sudo a2ensite example.co.uk.conf # enables conf file

sudo a2dissite example.co.uk.conf # disables conf file

Tip: Note that you can use tab to autofill the configuration files, as bash will know where the files are once you type a2ensite or a2dissite.

sudo a2enmod <module> # enables a module

sudo a2dismod <module> # disables a module

Configuration Files

/etc/apache2/apache2.conf # main configuration file

/etc/apache2/sites-available/example.co.uk.conf # example site

Analytics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment