Skip to content

Instantly share code, notes, and snippets.

@namedgraph
Last active October 1, 2017 22:03
Show Gist options
  • Save namedgraph/a08f22db7bf53ecc949910a02a94ce35 to your computer and use it in GitHub Desktop.
Save namedgraph/a08f22db7bf53ecc949910a02a94ce35 to your computer and use it in GitHub Desktop.
nginx XML conf
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="yes"/>
<xsl:template match="@*">
<xsl:text> </xsl:text>
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="*">
<xsl:value-of select="local-name()"/>
<xsl:apply-templates select="@*"/>
<xsl:choose>
<xsl:when test="not(*)">
<xsl:text>;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> {</xsl:text>
<xsl:apply-templates select="node()"/>
<xsl:text>}</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="conf" priority="1">
<xsl:apply-templates select="node()"/>
</xsl:template>
</xsl:stylesheet>
<conf>
<events>
<worker_connections number="1024"/>
</events>
<stream>
<upstream name="https">
<server address="platform:8443"/>
</upstream>
<upstream name="http">
<server address="platform:8080"/>
</upstream>
<server>
<listen port="443"/>
<server_name name="localhost"/>
<proxy_pass url="https"/>
</server>
<server>
<listen port="80"/>
<server_name name="localhost"/>
<proxy_pass url="http"/>
</server>
</stream>
</conf>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment