How to Install Apache on CentOS 7

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

16 Responses

  1. srju says:

    Sir, I have done exactly what you said in the tutorial, and i got the output also, but when i search using ip/localhost the website appear but when i enter the name of the site ( i created the page is not displaying and shows error.

    • Ravi Saive says:


      You need to add with your server IP address on your local machine hosts file from where you accessing the site.

      • srju says:

        Thank you,

        Let me check and tell you. if possible pleas share your mail id or anything to contact you personally.

  2. SANTANU says:

    How to install apache2 from source with all modules

  3. gaurav gregrath says:

    My Apache doesn’t run if i do not configure /etc/hosts file. So is it necessary to configure hosts file in etc directory?

  4. Boyong Lambert says:

    Great! Thank you for this tutorial.

  5. John says:

    Hello Sir i am new to Linux and I followed all your instructions but when i try to restart it this is what i get

    [[email protected] ~]# systemctl restart httpd.service
    Job for httpd.service failed because the control process exited with error code. 
    See "systemctl status httpd.service" and "journalctl -xe" for details.

    Please your help need this to work out for me thanks.

  6. John says:

    Hello Sir,

    I have done exactly what you did but the httpd refused to restart please see below.

    [[email protected] ~]# systemctl status httpd.service
    ● httpd.service - The Apache HTTP Server
       Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
       Active: failed (Result: exit-code) since Tue 2019-03-19 17:33:00 UTC; 16s ago
         Docs: man:httpd(8)
      Process: 90010 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
      Process: 90008 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
     Main PID: 90008 (code=exited, status=1/FAILURE)
    Mar 19 17:33:00 pdg httpd[90008]: AH00112: Warning: DocumentRoot [/var/www/
    Mar 19 17:33:00 pdg httpd[90008]: AH00558: httpd: Could not reliably
    Mar 19 17:33:00 pdg httpd[90008]: (2)No such file or directory: AH02291: Ca...:3
    Mar 19 17:33:00 pdg httpd[90008]: AH00014: Configuration check failed
    Mar 19 17:33:00 pdg systemd[1]: httpd.service: main process exited, code=ex...RE
    Mar 19 17:33:00 pdg kill[90010]: kill: cannot find process ""
    Mar 19 17:33:00 pdg systemd[1]: httpd.service: control process exited, code...=1
    Mar 19 17:33:00 pdg systemd[1]: Failed to start The Apache HTTP Server.
    Mar 19 17:33:00 pdg systemd[1]: Unit httpd.service entered failed state.
    Mar 19 17:33:00 pdg systemd[1]: httpd.service failed.
    Hint: Some lines were ellipsized, use -l to show in full.

    Please what can i do?

  7. Luke says:

    Hello Sir, I already did what you done, and the httpd.service is active (running) but when i type the IP address on my browser, i received a 504 Gateway timeout. What should i do??

    • Ravi Saive says:


      I think it’s due to proxy server settings, try to disable proxy in your browser and try.. If you still see same error, try to check the Apache logs at /var/log/httpd and fix the issue if any..

  8. Rajib Biswal says:

    Hello, Dear Sir

    My Apache web server stopped some how. I run service httpd restart on terminal, but it not worked.

    It show:

    [[email protected] ~]# service httpd restart

    httpd: Syntax error on line 216 of /usr/local/apps/apache/etc/httpd.conf: Syntax error on line 2 of /usr/local/apps/apache/etc/conf.d/wsgi.conf: Cannot load /us r/local/apps/apache/modules/ into server: /usr/local/apps/apache/modu les/ cannot open shared object file: No such file or directory

    Kindly tell me How To fix it.

    • Aaron Kili says:


      Run the command below:

      # mv /usr/local/apps/apache/etc/conf.d/wsgi.conf /usr/local/apps/apache/etc/conf.d/wsgi.conf.orig

      Then restart the Apache service, like this:

      # service httpd restart

      If this fails, try to check the mentioned files for any syntax errors on the specified lines.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.