Blog

Basic Apache Commands

When working with Apache as a web server, you might get scenario to troubleshoot it for errors, Basic Apache Commands, this article helps you with basic commands which are helpful troubleshooting as per your requirement.

If you are new to apache, and want to know basic difference between Apache and NGINX web server, read this Apache vs NGINX

To install Apache, visit first portion of this post : LAMP installation

Pro Tip: Apache by default runs on port 80 for HTTP traffic and port 443 for HTTPS traffic

service apache2 status

it will give you status of apache2 service.
It can be in running(Active) or stopped(Inactive) status

service apache2 start            #to start apache2 service
service apache2 stop             #to start apache2 service
service apache2 restart          #to re-start apache2 service, you may fire this when you have changed any apache configuration and want to reflect it

To enable SSL for apache, fire following

a2enmod ssl
service apache2 reload          #to reload configuration

If you are having htaccess file in code folder, then enable below configuration

a2enmod rewrite
service apache2 reload          #to reload configuration

To enable/disable different version of PHP installed

a2dismod php5.6                #to disable php5.6's configuration
a2enmod php7.1                 #to enable php7.1's configuration
service apache2 reload         #reload apache so that changes can reflect 

To enable newly written configuration file inside sites-available folder

a2ensite new-site-configuration.conf         #define file name here 

Let me know in comments if you face any issues

Summary
Article Name
Basic Apache Commands
Description
This article focuses on various basic apache commands that will be used on a daily basis when you configure and develop with it. You may need to <b>change some configuration, restart apache service and debug logs</b>. This article helps you to understand basic apache commands
Author
Publisher Name
IdenticalCloud

1 thought on “Basic Apache Commands”

Leave a Comment