Bitnami LAMP 在虚拟主机部分内堆叠虚拟主机

Bitnami LAMP 在虚拟主机部分内堆叠虚拟主机

我正在尝试设置虚拟主机,以便 Bitnami LAMP 堆栈上的 wordpress 应用程序可以托管在我的网站 www.iconverge.us 上。作为参考,我使用 AWS lightsail 作为主机。但我收到此错误:

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

这是我的 httpd-vhosts.conf 文件,位于目录 ~/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>

答案1

看起来您正在<VirtualHost>另一个<VirtualHost>标签内设置一个标签。我无法在~/apps/wordpress/conf/您分享的文件中直接看到这种情况,但此指令可以作为包含文件的一部分/opt/bitnami/apps/wordpress/conf/httpd-app.conf,您能看看这个文件是否包含<VirtualHost>标签吗?

答案2

检查您是否未包含/opt/bitnami/apps/wordpress/conf/httpd-vhosts.conf在内/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf

如果是,请将其删除或者注释掉。


按照以下方法应该这样做bitnami 文档

-注释掉文件中包含前缀配置文件的行/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf

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

-在文件中包括WordPress的虚拟主机配置文件/opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf

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

相关内容