Angle brackets appear everywhere in web hosting: Apache directives, Nginx location blocks, XML configuration files, HTML templates, and email headers. A single misplaced bracket can break your entire site or prevent your server from starting. This guide catalogs the most common angle bracket mistakes administrators and developers make, with the correct syntax for each scenario.
Apache Configuration Mistakes
Mismatched Directory and Location Tags
The most frequent Apache error is forgetting to close a directive block or mixing opening and closing tags.
Wrong:
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
# Missing closing tag
Correct:
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
Every opening tag like <Directory>, <VirtualHost>, <Location>, or <Files> requires a matching closing tag with a forward slash. Apache will fail to start with "Syntax error" if tags are unmatched.
Angle Brackets in SSLCertificateFile Paths
Administrators sometimes copy certificate paths with surrounding angle brackets from documentation examples.
Wrong:
SSLCertificateFile <path-to-your-certificate>
SSLCertificateKeyFile <path-to-your-key>
Correct:
SSLCertificateFile /etc/ssl/certs/example.com.crt
SSLCertificateKeyFile /etc/ssl/private/example.com.key
Angle brackets in Apache directives are reserved for container tags. File paths and directive values should never include them unless they are literal characters in a filename, which is itself a mistake.
Incorrect VirtualHost Syntax
Mixing up the VirtualHost IP and port syntax with XML-style attributes causes immediate failure.
Wrong:
<VirtualHost ip="*" port="80">
ServerName example.com
</VirtualHost>
Correct:
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/html
</VirtualHost>
The VirtualHost directive uses a space-separated format with a colon between IP and port, not XML attribute syntax.
Nesting Errors in .htaccess Files
.htaccess files allow certain directives but not others. Attempting to nest VirtualHost or Directory blocks inside .htaccess fails silently or throws errors.
Wrong:
<Directory /var/www/html/subdir>
Options -Indexes
</Directory>
Correct in .htaccess:
Options -Indexes
In .htaccess context, directives apply to the directory where the file resides. Container directives like Directory are not allowed.
Nginx Configuration Mistakes
Confusing Curly Braces with Angle Brackets
Nginx uses curly braces for blocks, not angle brackets. Administrators familiar with Apache sometimes mix syntax.
Wrong:
<server>
listen 80;
server_name example.com;
</server>
Correct:
server {
listen 80;
server_name example.com;
root /var/www/html;
}
Nginx configuration files never use angle brackets for structural blocks. All blocks use curly braces with semicolons ending individual directives.
Angle Brackets in Variable Substitution
Some administrators incorrectly use angle brackets when referencing Nginx variables.
Wrong:
proxy_set_header Host <$host>;
Correct:
proxy_set_header Host $host;
Nginx variables start with a dollar sign. Angle brackets have no special meaning in Nginx configuration syntax.
XML and YAML Configuration Mistakes
Self-Closing Tag Syntax Errors
XML configuration files for Java applications, Maven, or WordPress exports require proper self-closing tag syntax.
Wrong:
<property name="timeout" value="30">
<dependency></dependency/>
Correct:
<property name="timeout" value="30" />
<dependency></dependency>
Self-closing tags must end with a space and forward slash before the closing bracket. Empty paired tags should use full open and close syntax or proper self-closing format.
Mixing YAML and XML Syntax
YAML configuration files like those used by Docker Compose or Ansible do not use angle brackets at all.
Wrong:
<services>
<web>
image: nginx
Correct:
services:
web:
image: nginx
YAML uses indentation and colons. Angle brackets appearing in YAML are almost always copy-paste errors from XML or HTML.
HTML and Template Mistakes
Unclosed HTML Tags Breaking Pages
Forgetting to close HTML tags is common in hand-edited templates or PHP files.
Wrong:
<div class="container">
<h1>Welcome
<p>Content here</p>
</div>
Correct:
<div class="container">
<h1>Welcome</h1>
<p>Content here</p>
</div>
Most HTML tags require closing tags. Browsers may render broken HTML unpredictably, causing layout issues.
Angle Brackets in PHP Echo Statements
PHP code mixing HTML output sometimes escapes angle brackets incorrectly or forgets to close PHP tags.
Wrong:
<?php echo "<div class='header'"; ?>
Correct:
<?php echo "<div class='header'>"; ?>
When echoing HTML from PHP, ensure all tags are complete within the string, including closing brackets.
WordPress Shortcode Bracket Confusion
WordPress uses square brackets for shortcodes, but users sometimes type angle brackets instead.
Wrong:
<contact-form-7 id="123">
Correct:
[contact-form-7 id="123"]
WordPress shortcodes always use square brackets. Angle brackets will render as literal text instead of executing the shortcode.
Email Header and DNS Record Mistakes
SPF Record Syntax Errors
SPF records in DNS sometimes get angle brackets added around mechanisms or modifiers.
Wrong:
v=spf1 <include:_spf.google.com> ~all
Correct:
v=spf1 include:_spf.google.com ~all
SPF record syntax uses plain text mechanisms without any bracketing. Angle brackets invalidate the record.
DKIM Selector Confusion
DKIM DNS records use specific formatting, and angle brackets never appear in the actual DNS value.
Wrong:
default._domainkey IN TXT "v=DKIM1; k=rsa; p=<key-data>"
Correct:
default._domainkey IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCS..."
The public key value is a long base64 string with no brackets. Placeholder text from documentation should be replaced with actual key material.
Shell Script and Command Line Mistakes
Confusing Redirection with Tags
Shell redirection operators use angle brackets, but they are not XML tags.
Wrong:
cat </etc/hosts/>
Correct:
cat </etc/hosts
cat /etc/hosts > output.txt
Single < redirects input from a file. Single > redirects output to a file. They are not paired open/close tags.
Here-Document Syntax Errors
Here-documents use double angle brackets to create multi-line input, but the syntax must be exact.
Wrong:
cat > config.txt <EOF>
line1
line2
EOF>
Correct:
cat > config.txt <<EOF
line1
line2
EOF
The here-document delimiter uses << followed by a word, then the content, then the same word alone on a line. No closing brackets on the delimiter.
How to Avoid Angle Bracket Mistakes
Use Syntax Validation Tools
Before restarting services, validate configuration syntax:
# Apache
apachectl configtest
# Nginx
nginx -t
# XML files
xmllint --noout config.xml
These commands catch mismatched tags before they cause downtime.
Enable Editor Syntax Highlighting
Use editors with syntax highlighting for the specific file type. Properly configured highlighting makes mismatched brackets immediately visible. SSH-accessible editors like vim and nano support syntax highlighting for common formats.
Keep a Reference Checklist
- Apache: All
<Directive>tags need</Directive> - Nginx: Use
{ }not< > - XML: Empty tags can be
<tag />or<tag></tag> - HTML: Most tags need closing tags; void elements like
<img>do not - Shell:
<is input redirection,>is output redirection,<<starts here-docs - DNS: No angle brackets in SPF, DKIM, or other TXT records
Review Changes in Staging First
Test all configuration changes on a staging server or in a backup configuration file before deploying to production. This isolates syntax errors from live traffic.
Use Version Control
Track configuration files in Git. A diff view shows exactly what changed and makes it easy to spot introduced syntax errors:
git diff /etc/apache2/sites-available/example.conf
Conclusion
Angle brackets serve different purposes across web hosting technologies: container directives in Apache, literal characters in HTML, redirection in shells, and structured syntax in XML. The most common mistakes stem from mixing syntax conventions between systems or forgetting closing tags. Validate configuration syntax before restarting services, use appropriate editor tooling, and test changes in staging environments. By understanding the correct angle bracket syntax for each context, you avoid breaking production servers and wasting hours debugging configuration errors.
