如何在Bitnami红宝石堆栈中配置子域

我正在Google Cloud上使用Bitnami红宝石堆栈,该堆栈同时支持php和nodejs。我想要我想在主域上运行的express js应用程序。例如www.example.com,我还有另外两个codeigniter应用(PHP),我希望它们在one.example.com之类的子域上运行,而另一个在two.example.com之类的域上运行。

我关注了1 2 3这样的Bitnami文章,但我仍然无法使两个应用程序都能很好地运行。

我将所有应用放在/opt/bitnami/apps内,每个应用文件夹都有2个子文件夹,分别是conf和htdocs,如文章所述。

以下是我希望其在子域上运行的codeigniter应用程序的 conf 文件夹中的内容。

/opt/bitnami/apps/one/conf/httpd-app.conf

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

/opt/bitnami/apps/one/conf/httpd-vhosts.conf

<VirtualHost *:8080>
    ServerName one.example.com
    ServerAlias www.one.example.com
    DocumentRoot "/opt/bitnami/apps/one/htdocs"
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1$1 [R=permanent,L]

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

<VirtualHost *:8444>
    ServerName one.example.com
    ServerAlias www.one.example.com
    DocumentRoot "/opt/bitnami/apps/one/htdocs"
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1$1 [R=permanent,L]

    Include "/opt/bitnami/apps/one/conf/httpd-app.conf"
</VirtualHost>
我要在主域上运行的nodejs应用的

conf

/opt/bitnami/apps/main/conf/httpd-app.conf

ProxyPass / http://127.0.0.1:2000/
ProxyPassReverse / http://127.0.0.1:2000/

/opt/bitnami/apps/nyererefy/conf/httpd-vhosts.conf

<VirtualHost *:80>
  ServerName example.com
  ServerAlias www.example.com

  # redirect www and non-www http routes to https-non-www:
  RewriteEngine On
  RewriteCond %{HTTPS} off [OR]
  RewriteCond %{HTTP_HOST} ^www\. [NC]
  RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
  RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]

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

<VirtualHost *:443>
  ServerName example.com
  ServerAlias www.example.com

  #redirect https-wwww to https-non-www
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^www\. [NC]
  RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
  RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]

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

/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf

# Bitnami applications installed in a prefix URL
Include "/opt/bitnami/apps/phpmyadmin/conf/httpd-prefix.conf"
Include "/opt/bitnami/apps/phppgadmin/conf/httpd-prefix.conf"
Include "/opt/bitnami/apps/letsencrypt/conf/httpd-prefix.conf"

/opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf

# Bitnami applications installed in a Virtual Host
Include "/opt/bitnami/apps/one/conf/httpd-vhosts.conf"
Include "/opt/bitnami/apps/main/conf/httpd-vhosts.conf"

/opt/bitnami/apache2/conf/bitnami/bitnami.conf

# Default Virtual Host configuration.

<IfVersion < 2.3 >
  NameVirtualHost *:80
  NameVirtualHost *:443
</IfVersion>

<VirtualHost _default_:80>
  DocumentRoot "/opt/bitnami/apache2/htdocs"
  <Directory "/opt/bitnami/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    <IfVersion < 2.3 >
      Order allow,deny
      Allow from all
    </IfVersion>
    <IfVersion >= 2.3 >
      Require all granted
    </IfVersion>
  </Directory>

  # Error Documents
  ErrorDocument 503 /503.html

  # Bitnami applications installed with a prefix URL (default)
  Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf"
</VirtualHost>

# Default SSL Virtual Host configuration.

<IfModule !ssl_module>
  Loadmodule ssl_module modules/mod_ssl.so
</IfModule>

Listen 443
SSLProtocol all -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !EDH !RC4"
SSLPassphraseDialog  builtin
SSLSessionCache "shmcb:/opt/bitnami/apache2/logs/ssl_scache(512000)"
SSLSessionCacheTimeout  300

<VirtualHost _default_:443>
  DocumentRoot "/opt/bitnami/apache2/htdocs"
  SSLEngine on
SSLCertificateFile "/opt/bitnami/apache2/conf/server.crt"
SSLCertificateKeyFile "/opt/bitnami/apache2/conf/server.key"

  <Directory "/opt/bitnami/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    <IfVersion < 2.3 >
      Order allow,deny
      Allow from all
    </IfVersion>
    <IfVersion >= 2.3 >
      Require all granted
    </IfVersion>
  </Directory>

  # Error Documents
  ErrorDocument 503 /503.html

  # Bitnami applications installed with a prefix URL (default)
  Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf"
</VirtualHost>

# Bitnami applications that uses virtual host configuration
Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf"

# Status
ExtendedStatus on
<VirtualHost _default_:80>
ServerName local-stackdriver-agent.stackdriver.com
<Location /server-status>
  SetHandler server-status
  Order deny,allow
  Deny from all
  Allow from 127.0.0.1
</Location>
</VirtualHost>

如何配置它们一起运行?

zhchea 回答:如何在Bitnami红宝石堆栈中配置子域

Bitnami开发人员在这里!

您需要将所有应用程序配置为使用Apache虚拟主机。

首先,您需要更改要使用虚拟主机配置的默认根应用程序,而不是使用Apache前缀。

这是通过文件awk -v RS="" ' ##Starting awk program from here and setting RS(record separator) as NULL here. match($0,/.*,/){ ##Using match function of awk to match a regex till last occurrence of comma. print substr($0,RSTART,RLENGTH-1) substr($0,RSTART+RLENGTH) ##Printing substring from RSTART to till value of RLENGTH-1 then again mentioning substrnig from RSTART+RLENGTH to till end of Input_file. } ##Closing BLOCK for match condition here. ' Input_file ##Mentioning Input_file name here. /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf完成的。

第二,您还需要将codeigniter应用程序配置为虚拟主机。本指南可能会有所帮助。

https://docs.bitnami.com/general/infrastructure/lapp/configuration/configure-custom-application/

此外,如果您有任何问题,请随时在Bitnami社区论坛中打开案例。

本文链接:https://www.f2er.com/2992745.html

大家都在问