Setting Up Subdomains in DirectAdmin
52 vues
DNS & Domains
<h3>Creating and Managing Subdomains</h3>
<p>Subdomains allow you to create separate sections of your website under your main domain. For example, <code>blog.example.com</code> or <code>shop.example.com</code>. Each subdomain can host different content or even a completely different website.</p>
<h3>Creating a Subdomain</h3>
<ol>
<li>Log in to DirectAdmin.</li>
<li>Navigate to <strong>Account Manager → Subdomain Management</strong>.</li>
<li>Enter the desired subdomain name in the text field (e.g., type <code>blog</code> to create <code>blog.example.com</code>).</li>
<li>Click <strong>Create</strong> or <strong>Add Subdomain</strong>.</li>
</ol>
<p>DirectAdmin will automatically create a directory for the subdomain at <code>/domains/example.com/public_html/blog/</code>. Upload your files to this directory to make them accessible via the subdomain URL.</p>
<h3>Subdomain Document Root</h3>
<p>By default, subdomain files are stored as a subfolder within your main domain's <code>public_html</code> directory. The typical path structure is:</p>
<pre><code>/home/username/domains/example.com/public_html/blog/</code></pre>
<p>This means files at <code>public_html/blog/index.html</code> will be accessible at both <code>blog.example.com</code> and <code>example.com/blog/</code>.</p>
<h3>DNS for Subdomains</h3>
<p>DirectAdmin automatically creates the necessary DNS A record for your subdomain when you create it. The subdomain will point to the same IP as your main domain. If your domain uses external DNS (e.g., Cloudflare), you will need to manually add an A record:</p>
<pre><code>Type: A
Name: blog
Value: [your server IP]
TTL: 3600</code></pre>
<div class="alert alert-info"><strong>Wildcard Subdomains:</strong> To make all subdomains point to your server, create an A record for <code>*</code> pointing to your server IP. This is useful for applications that dynamically generate subdomains.</div>
<h3>SSL for Subdomains</h3>
<p>Each subdomain needs its own SSL coverage. When requesting a Let's Encrypt certificate, make sure to include the subdomain in the certificate. Alternatively, request a wildcard certificate (<code>*.example.com</code>) to cover all subdomains automatically.</p>
<h3>Deleting a Subdomain</h3>
<ol>
<li>Go to <strong>Subdomain Management</strong>.</li>
<li>Select the subdomain you wish to remove.</li>
<li>Click <strong>Delete</strong>.</li>
</ol>
<p>Note that deleting a subdomain in DirectAdmin removes the DNS record and configuration, but the directory and its files may remain on the server. Remove them manually via the File Manager if needed.</p>
Besoin d'aide ?
Vous ne trouvez pas ce que vous cherchez ? Notre équipe de support est prête à vous aider.
Contacter le support