Hi i have this problem, apache doesn't start and give me some errors

Keywords: Apache Airflow - Linux - Technical issue - Secure Connections (SSL/HTTPS)
bnsupport ID: 6d4ffa6a-3bd2-824d-6d2f-b00e0dc2c0cb
Description:
6d4ffa6a-3bd2-824d-6d2f-b00e0dc2c0cb

Hi i have this problem, apache doesn’t start and give me this errors:

sudo /opt/bitnami/ctlscript.sh start
/opt/bitnami/mysql/scripts/ctl.sh : mysql (pid 1028) already running
/opt/bitnami/php/scripts/ctl.sh : php-fpm (pid 1121) already running
httpd.bin: Syntax error on line 562 of /opt/bitnami/apache2/conf/httpd.conf: Syntax error
on line 26 of /opt/bitnami/apache2/conf/bitnami/bitnami.conf: Syntax error on line 2 of /o
pt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf: Syntax error on line 11 of /opt/
bitnami/apps/wordpress/conf/httpd-prefix.conf: Syntax error on line 12 of /opt/bitnami/app
s/wordpress/conf/httpd-app.conf: Syntax error on line 109 of /opt/bitnami/apps/wordpress/c
onf/htaccess.conf: without matching section
apache config test fails, aborting
Error:
Message from VCC-compiler:
No backends or directors found in VCL program, at least one is necessary.
Running VCC-compiler failed, exited with 2
VCL compilation failed
/opt/bitnami/varnish/scripts/ctl.sh : varnish could not be started

Hello @francescomassari.web,

As the output says, there is a syntax error on line 109 of your /opt/bitnami/apps/wordpress/conf/htaccess.conf, where there is a tag </Directory> that should be removed.

Your file /opt/bitnami/varnish/etc/varnish/default.vcl seems to be empty. This is the original data:

# This is the VCL configuration Varnish will automatically append to your VCL
# file during compilation/loading. See the vcl(7) man page for details on syntax
# and semantics.
# New users is recommended to use the example.vcl file as a starting point.
# 
# sub vcl_recv {
#     if (req.method == "PRI") {
#         /* This will never happen in properly formed traffic (see: RFC7540) */
#         return (synth(405));
#     }
#     if (!req.http.host &&
#       req.esi_level == 0 &&
#       req.proto ~ "^(?i)HTTP/1.1") {
#         /* In HTTP/1.1, Host is required. */
#         return (synth(400));
#     }
#     if (req.method != "GET" &&
#       req.method != "HEAD" &&
#       req.method != "PUT" &&
#       req.method != "POST" &&
#       req.method != "TRACE" &&
#       req.method != "OPTIONS" &&
#       req.method != "DELETE" &&
#       req.method != "PATCH") {
#         /* Non-RFC2616 or CONNECT which is weird. */
#         return (pipe);
#     }
# 
#     if (req.method != "GET" && req.method != "HEAD") {
#         /* We only deal with GET and HEAD by default */
#         return (pass);
#     }
#     if (req.http.Authorization || req.http.Cookie) {
#         /* Not cacheable by default */
#         return (pass);
#     }
#     return (hash);
# }
# 
# sub vcl_pipe {
#     # By default Connection: close is set on all piped requests, to stop
#     # connection reuse from sending future requests directly to the
#     # (potentially) wrong backend. If you do want this to happen, you can undo
#     # it here.
#     # unset bereq.http.connection;
#     return (pipe);
# }
# 
# sub vcl_pass {
#     return (fetch);
# }
# 
# sub vcl_hash {
#     hash_data(req.url);
#     if (req.http.host) {
#         hash_data(req.http.host);
#     } else {
#         hash_data(server.ip);
#     }
#     return (lookup);
# }
# 
# sub vcl_purge {
#     return (synth(200, "Purged"));
# }
# 
# sub vcl_hit {
#     if (obj.ttl >= 0s) {
#         // A pure unadulterated hit, deliver it
#         return (deliver);
#     }
#     if (obj.ttl + obj.grace > 0s) {
#         // Object is in grace, deliver it
#         // Automatically triggers a background fetch
#         return (deliver);
#     }
#     // fetch & deliver once we get the result
#     return (miss);
# }
# 
# sub vcl_miss {
#     return (fetch);
# }
# 
# sub vcl_deliver {
#     return (deliver);
# }
# 
# /*
#  * We can come here "invisibly" with the following errors: 500 & 503
#  */
# sub vcl_synth {
#     set resp.http.Content-Type = "text/html; charset=utf-8";
#     set resp.http.Retry-After = "5";
#     set resp.body = {"<!DOCTYPE html>
# <html>
#   <head>
#     <title>"} + resp.status + " " + resp.reason + {"</title>
#   </head>
#   <body>
#     <h1>Error "} + resp.status + " " + resp.reason + {"</h1>
#     <p>"} + resp.reason + {"</p>
#     <h3>Guru Meditation:</h3>
#     <p>XID: "} + req.xid + {"</p>
#     <hr>
#     <p>Varnish cache server</p>
#   </body>
# </html>
# "};
#     return (deliver);
# }
# 
# #######################################################################
# # Backend Fetch
# 
# sub vcl_backend_fetch {
#     if (bereq.method == "GET") {
#         unset bereq.body;
#     }
#     return (fetch);
# }
# 
# sub vcl_backend_response {
#     if (bereq.uncacheable) {
#         return (deliver);
#     } else if (beresp.ttl <= 0s ||
#       beresp.http.Set-Cookie ||
#       beresp.http.Surrogate-control ~ "(?i)no-store" ||
#       (!beresp.http.Surrogate-Control &&
#         beresp.http.Cache-Control ~ "(?i:no-cache|no-store|private)") ||
#       beresp.http.Vary == "*") {
#         # Mark as "Hit-For-Miss" for the next 2 minutes
#         set beresp.ttl = 120s;
#         set beresp.uncacheable = true;
#     }
#     return (deliver);
# }
# 
# sub vcl_backend_error {
#     set beresp.http.Content-Type = "text/html; charset=utf-8";
#     set beresp.http.Retry-After = "5";
#     set beresp.body = {"<!DOCTYPE html>
# <html>
#   <head>
#     <title>"} + beresp.status + " " + beresp.reason + {"</title>
#   </head>
#   <body>
#     <h1>Error "} + beresp.status + " " + beresp.reason + {"</h1>
#     <p>"} + beresp.reason + {"</p>
#     <h3>Guru Meditation:</h3>
#     <p>XID: "} + bereq.xid + {"</p>
#     <hr>
#     <p>Varnish cache server</p>
#   </body>
# </html>
# "};
#     return (deliver);
# }
# 
# #######################################################################
# # Housekeeping
# 
# sub vcl_init {
#     return (ok);
# }
# 
# sub vcl_fini {
#     return (ok);
# }

vcl 4.0;

backend default {
    .host = "127.0.0.1";
    .port = "80";
}

sub vcl_recv {
    if ((req.url ~ "^/phpmyadmin/.*$" || req.url ~ "^/phppgadmin/.*$" || req.url ~ "^/server-status.*$") && client.ip != "127.0.0.1") {
        return(synth(403, "For security reasons, this URL is only accessible using localhost (127.0.0.1) as the hostname."));
    }
}

I hope it helps

Hi DavidG,
now apache started, but when i try to open the website it tells me " Bad Request".
I try to add a certificate ssl on custom domains it is working but i can’t see the website also from cloudfron t address because that error " Bad request", i hope you can hel me again, thanks

Hi @francescomassari.web,

Could you please share with us a new support tool output? It is a good practice after every change so we can check the latest configuration and logs.

Regards

08b8f8ce-9970-23f6-06d9-1e433fe6b9b2

08b8f8ce-9970-23f6-06d9-1e433fe6b9b2

Hello @francescomassari.web,

I have found a similar previous case that may help:

I can see you have edited several apache configuration files, and that may be the reason for this error. For example, this is the original file for /opt/bitnami/apps/wordpress/conf/httpd-app.conf:

RewriteEngine On
RewriteRule /<none> / [L,R]

<IfDefine USE_PHP_FPM>
    <Proxy "unix:/opt/bitnami/php/var/run/wordpress.sock|fcgi://wordpress-fpm" timeout=300>
    </Proxy>
</IfDefine>

<Directory "/opt/bitnami/apps/wordpress/htdocs">
    Options +MultiViews +FollowSymLinks
    AllowOverride None
    <IfVersion < 2.3 >
        Order allow,deny
        Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
        Require all granted
    </IfVersion>


    <IfModule php7_module>
            php_value memory_limit 512M
    </IfModule>

    <IfDefine USE_PHP_FPM>
       <FilesMatch \.php$>
         SetHandler "proxy:fcgi://wordpress-fpm"
       </FilesMatch>
    </IfDefine>


    RewriteEngine On
    #RewriteBase /wordpress/
    RewriteRule ^index\.php$ - [S=1]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . index.php [L]

    Include "/opt/bitnami/apps/wordpress/conf/banner.conf"
</Directory>

Include "/opt/bitnami/apps/wordpress/conf/htaccess.conf"

and this is your file:

 <Directory "/opt/bitnami/apps/wordpress/htdocs">
      Options +MultiViews
      AllowOverride None
      <IfVersion < 2.3 >
      Order allow,deny
      Allow from all
      </IfVersion>
      <IfVersion >= 2.3>
      Require all granted
      </IfVersion>
  </Directory>
  Include "/opt/bitnami/apps/wordpress/conf/htaccess.conf"

You could compare your files with the ones under /opt/bitnami/original-data in order to check the changes that you implemented and revert those ones that are not necessary.

Regards