1

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?

Kamran
  • 1,425
  • 7
  • 17
Santosh
  • 111
  • 4
  • 1
    Are you SURE you are on App Engine? When working with App Engine, you normally only send your code and have it run. Are you on ManagedVMs? Or really on App Engine? Or is this a confusion between App and Compute? – Patrice Nov 03 '15 at 15:51
  • No I am not on appengine, but using a VM with LAMP stack in google cloud. – Santosh Nov 11 '15 at 12:31
  • This is Apache configuration question. A similar question with a good answer has been posted on [this thread](http://stackoverflow.com/questions/758351/virtualhost-for-wildcard-subdomain-and-static-subdomain?answertab=votes#tab-top). – Kamran Nov 13 '16 at 17:27

1 Answers1

1

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.

Jordan
  • 301
  • 2
  • 8