Skeleton's Apache configuration

With the Symfony environment mechanism, it's possible to only deploy one Skeleton to rule all frontend websites. All environment websites for the same content, but not only. All you have to do is defined Apache VirtualHost:

<VirtualHost *:80>
    ServerName domain.tld
    ServerAlias www.domain.tld

    DocumentRoot /var/www/skeleton-3.0.43/public
    DirectoryIndex /index.php

    <Directory /var/www/skeleton-3.0.43/public>
        AllowOverride None
        Order Allow,Deny
        Allow from All

        FallbackResource /index.php
    </Directory>

    # uncomment the following lines if you install assets as symlinks
    # or run into problems when compiling LESS/Sass/CoffeeScript assets
    # <Directory /var/www/project>
    #     Options FollowSymlinks
    # </Directory>

    # optionally disable the fallback resource for the asset directories
    # which will allow Apache to return a 404 error when files are
    # not found instead of passing the request to Symfony
    <Directory /var/www/project/public/bundles>
        FallbackResource disabled
    </Directory>
    ErrorLog /var/log/apache2/project_error.log
    CustomLog /var/log/apache2/project_access.log combined

    # set the value of the environment variables used in the application:

    ###> symfony/framework-bundle ###
    SetEnv APP_ENV "prod"
    SetEnv APP_SECRET "ThisIsNotASecret"
    #SetEnv TRUSTED_PROXIES "127.0.0.1,127.0.0.2"
    #SetEnv TRUSTED_HOSTS=localhost,example.com
    ###< symfony/framework-bundle ###

    ###> symfony/swiftmailer-bundle ###
    SetEnv MAILER_URL "null://localhost"
    ###< symfony/swiftmailer-bundle ###

    ###> doctrine/doctrine-bundle ###
    SetEnv DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name
    ###< doctrine/doctrine-bundle ###

    ###> elasticms/client-help-bundle ### 
    SetEnv EMSCH_LOCALES '["en"]'
    SetEnv DEFAULT_LOCAL en
    SetEnv EMSCH_ELASTICSEARCH_CLUSTER '["http://aurora:9200", "http://septune:9200"]'
    SetEnv EMSCH_INSTANCE_ID "emseu_v4_"
    SetEnv EMSCH_BACKEND_URL 'https://admin.elasticms.eu'
    SetEnv EMSCH_ENVS '{"template":{"regex":"/^template.*/","index":"template","backend":"https://admin.elasticms.eu"},"staging":{"regex":"/^staging.*/","index":"staging","backend":"https://admin.elasticms.eu"},"preview":{"regex":"/^preview.*/","index":"preview","backend":"http://admin.elasticms.eu"},"live":{"regex":"/.*/","index":"live"}}'
    #SetEnv STORAGE_PATH '../var/assets'
    SetEnv EMSCH_TRANSLATION_TYPE label
    SetEnv EMSCH_REDIRECT_TYPE 'redirect'
    SetEnv EMSCH_ROUTE_TYPE 'route'
    #SetEnv EMSCH_ASSET_CONFIG_TYPE 'asset_config'
    SetEnv EMSCH_SEARCH_CONFIG '{"types":["page"],"fields":["title_%locale%","all_%locale%"],"synonyms":[{"field":"taxonomies","types":["taxonomy"],"search":"title_%locale%"}],"highlight":{"pre_tags":["<em>"],"post_tags":["</em>"],"fields":{"all_%locale%":{"fragment_size":250,"number_of_fragments":1}}},"sizes":[10],"analyzers":{"fr":"french","nl":"dutch","en":"english","de":"german"},"suggestFields":{"fr":["all_fr"],"nl":["all_nl"],"en":["suggest_en"],"de":["all_de"]},"filters":{"contenttype":{"type":"terms","field":"_contenttype","optional":false,"aggs_size":50},"taxonomies":{"type":"terms","field":"taxonomies","optional":false,"aggs_size":50}}}'
    SetEnv EMSCH_TEMPLATES '{"template": {"name": "key","code": "body"}}'
    #SetEnv EMSCH_TEMPLATE_LANGUAGE='@EMSCH/template/language_select.html.twig'
    #SetEnv EMSCH_TEMPLATE_SEARCH='@EMSCH/template/services-list.html.twig'
    SetEnv EMSCH_TEMPLATE_ERROR '@EMSCH/template/error{code}.html.twig'
    ###< elasticms/client-help-bundle ### 

    #ProxyPreserveHost On
    #ProxyRequests on

    #ProxyPass / http://127.0.0.1:8080/
    #ProxyPassreverse / http://127.0.0.1:8080/

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

Everything looks like Symfony optimized Apache config. Where all environment varirables are defined via SetEnv rules. 

You can defined one Apache VirtualHost per config you need. You can also define Apache Alias. like this:

Alias "/preview" "/var/www/skeleton-3.0.43/public"

With an alias the base url of the request will be affected: http://www.domain.tld/preview in that case you can use the EMSCH_ENVS variable to specify an enviroment per alias. Caution that by default to access to this website you have to call the http://www.domain.tld/preview/index.php url (otherwise the request will fallback to the fallback url wich is /index.php (probably the live environment).

To handle upgrade and migration it could be a good idea to deploy each Skeleton version in there own folder.