awsjenkins

Debug Apache errors

Once Apache starts, it will create two log files at /opt/bitnami/apache/logs/access_log and /opt/bitnami/apache/logs/error_log respectively.

  • The access_log file is used to track client requests. When a client requests a document from the server, Apache records several parameters associated with the request in this file, such as: the IP address of the client, the document requested, the HTTP status code, and the current time.

  • The error_log file is used to record important events. This file includes error messages, startup messages, and any other significant events in the life cycle of the server. This is the first place to look when you run into a problem when using Apache.

If no error is found, you will see a message similar to:

Syntax OK

Startup errors

  • Check the Apache error log file

    Check the Apache error log file at /opt/bitnami/apache/logs/error_log for information about why the error occurred.

  • Check if another process is listening to that port

    If another process is using that address you’ll get:

      (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:port_number
      no listening sockets available, shutting down
    

    To see which process is already using that port you can run the following from a command prompt. Replace the PORT placeholder with the correct port number, such as 80 or 443.

      $ sudo netstat -ltnp | grep PORT
    

    In the last column you’ll see the process id or process name. You can then use:

      $ ps aux | grep process_name
    

    Look for the pid in the second column and you’ll get more information about that process.

    In case another process is using that port, use another port or stop that process.

  • Check permissions and ownership

    Check if you have permissions to bind Apache to the requested port. To bind Apache to privileged ports, start Apache as root. If you don’t have permissions to bind Apache to some port, you’ll see this error:

      (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:port_number
      no listening sockets available, shutting down
    

    If Apache is unable to open the configuration or the log file, check that the owner of those files is the same user account that installed Apache and that it has write permissions on logs and read permissions on the configuration file. If this is not the case, you will see these errors:

      (13)Permission denied: AH00649: could not open transfer log file .../access_log.
      AH00015: Unable to open logs
    
      (13)Permission denied: AH00091: httpd: could not open error log file .../error_log.
      AH00015: Unable to open logs
    
      httpd: Could not open configuration file .../httpd.conf: Permission denied
      apache config test fails, aborting
    

SSL errors

The message “Your connection to this site is only partially encrypted…” appears when you enable SSL for your site but there are some resources referenced by unencrypted HTTP URLs in your page.

To check if this is the case, view the page source and check for any http:// references. To resolve the issue, manually update your themes or templates and change any URLs to relative URLs. More specifically, instead of using http:// in your code, use //:, as below:

<img src='//example.com/img.png'/>

IMPORTANT: For security reasons, never post or disclose your server’s SSL private key in a public forum.

Last modification April 5, 2023