Creating subdomain in google cloud LAMP stack

cloudgooglegoogle-cloud-platformlampsubdomain

I have installed the LAMP stack, and mapped my domain name "example.com" to my external IP in Google Compute Engine.

Now I need to create a subdomain and map it to some folder in the same instance.

So ,
I checked the url https://cloud.google.com/appengine/docs/using-custom-domains-and-ssl?hl=uk#using_subdomains
but it does not say anything about editing the vhosts file.

The configuration files for apache in Compute Engine VM is present at etc/apache2/ folder

LOCAL CONFIG in XAMPP

<VirtualHost *:8001>
ServerAdmin postmaster@dummy-host2.localhost
    DocumentRoot "C:\xampp\htdocs\XYZ\public"
    ServerName localhost:8001
    <Directory "C:\xampp\htdocs\XYZ\public">
     Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        Order Deny,Allow
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

But in etc/apache2/ lamp-server.conf, the configuration is as follows

<VirtualHost *:80>
  ServerAdmin webmaster@localhost
  DocumentRoot /var/www/html
  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>
  <Directory /var/www/html/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>
  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
  </Directory>
  ErrorLog ${APACHE_LOG_DIR}/error.log
  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel warn
  CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

So how do we edit the apache configuration files in google compute engine LAMP stack to add subdomains and link it to some folder in instance?

Best Answer

As this is an old question without an answer that is still getting views, I am posting Kamran's last comment as an answer which points to the solution in this thread.

Related Topic