0

I am trying to set up a virtual host so that my wordpress app on the Bitnami LAMP stack can be hosted on my website, www.iconverge.us. For reference, I am using AWS lightsail as my host. But I am getting this error:

bitnami@ip:~/apps/wordpress/conf$ sudo /opt/bitnami/ctlscript.sh restart apache
Unmonitored apache
AH00526: Syntax error on line 1 of /opt/bitnami/apps/wordpress/conf/httpd-vhosts.conf:
<VirtualHost> cannot occur within <VirtualHost> section
apache config test fails, aborting

AH00526: Syntax error on line 1 of /opt/bitnami/apps/wordpress/conf/httpd-vhosts.conf:
<VirtualHost> cannot occur within <VirtualHost> section
apache config test fails, aborting
Monitored apache

This is my httpd-vhosts.conf file, in the directory ~/apps/wordpress/conf/:

<VirtualHost *:80>
    ServerName www.iconverge.us
    ServerAlias iconverge.us *.iconverge.us
    DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"

    Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
</VirtualHost>

<VirtualHost *:443>
    ServerName www.iconverge.us
    ServerAlias iconverge.us *.iconverge.us
    DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"
    SSLEngine on
    SSLCertificateFile "/opt/bitnami/apps/wordpress/conf/certs/server.crt"
    SSLCertificateKeyFile "/opt/bitnami/apps/wordpress/conf/certs/server.key"

    Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
</VirtualHost>
Noooo
  • 3
  • 3

2 Answers2

0

It seems that you are setting a <VirtualHost> label inside another <VirtualHost> label. I can't see this situation directly in the ~/apps/wordpress/conf/ you're sharing, but this directive can be a part of included file /opt/bitnami/apps/wordpress/conf/httpd-app.conf, can you take a look if this file contains a <VirtualHost> label?

  • This does not contain a `` label. It instead has a `` and also a RewriteEngine On, RewriteRule, etc. However, it includes `htaccess.conf`, which does not have `` either – Noooo Jan 29 '18 at 17:20
  • I am also following this [guide](https://docs.bitnami.com/general/components/apache/#How_to_create_a_Virtual_Host.3f) on creating virtual hosts exactly. – Noooo Jan 29 '18 at 17:27
0

Check if you didn't include /opt/bitnami/apps/wordpress/conf/httpd-vhosts.conf in /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf.

If so, remove or comment it out.


This is how it should be done according to bitnami docs:

-Comment out the line that includes the prefix configuration file in the /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf file:

  # Include "/opt/bitnami/apps/wordpress/conf/httpd-prefix.conf"

-Include the virtual host configuration file for WordPress in the /opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf file:

  Include "/opt/bitnami/apps/wordpress/conf/httpd-vhosts.conf"