PageRenderTime 45ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/dashboard/docs/configure-vhosts.html

https://gitlab.com/haris4445/techarena
HTML | 251 lines | 229 code | 18 blank | 4 comment | 0 complexity | 3744a4397105f2141360c27316975215 MD5 | raw file
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <!-- Always force latest IE rendering engine or request Chrome Frame -->
  6. <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  8. <!-- Use title if it's in the page YAML frontmatter -->
  9. <title>Configure Virtual Hosts</title>
  10. <link href="/dashboard/stylesheets/normalize.css" rel="stylesheet" type="text/css" /><link href="/dashboard/stylesheets/all.css" rel="stylesheet" type="text/css" />
  11. <link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/3.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
  12. <script src="/dashboard/javascripts/modernizr.js" type="text/javascript"></script>
  13. <link href="/dashboard/images/favicon.png" rel="icon" type="image/png" />
  14. </head>
  15. <body class="docs docs_configure-vhosts">
  16. <div id="fb-root"></div>
  17. <script>(function(d, s, id) {
  18. var js, fjs = d.getElementsByTagName(s)[0];
  19. if (d.getElementById(id)) return;
  20. js = d.createElement(s); js.id = id;
  21. js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=277385395761685";
  22. fjs.parentNode.insertBefore(js, fjs);
  23. }(document, 'script', 'facebook-jssdk'));</script>
  24. <div class="contain-to-grid">
  25. <nav class="top-bar" data-topbar>
  26. <ul class="title-area">
  27. <li class="name">
  28. <h1><a href="/dashboard/index.html">Apache Friends</a></h1>
  29. </li>
  30. <li class="toggle-topbar menu-icon">
  31. <a href="#">
  32. <span>Menu</span>
  33. </a>
  34. </li>
  35. </ul>
  36. <section class="top-bar-section">
  37. <!-- Right Nav Section -->
  38. <ul class="right">
  39. <li class=""><a href="/applications.html">Applications</a></li>
  40. <li class=""><a href="/dashboard/faq.html">FAQs</a></li>
  41. <li class="active"><a href="/dashboard/howto.html">HOW-TO Guides</a></li>
  42. <li class=""><a target="_blank" href="/dashboard/phpinfo.php">PHPInfo</a></li>
  43. <li class=""><a href="/phpmyadmin/">phpMyAdmin</a></li>
  44. </ul>
  45. </section>
  46. </nav>
  47. </div>
  48. <div id="wrapper">
  49. <div class="hero">
  50. <div class="row">
  51. <div class="large-12 columns">
  52. <h1>Documentation</h1>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="row">
  57. <div class="large-12 columns">
  58. <ul class="sub-nav">
  59. <li>
  60. <a class="pdf" target="_blank" href="/dashboard/docs/configure-vhosts.pdf"> Download PDF
  61. <span>configure-vhosts.pdf</span>
  62. </a> </li>
  63. </ul>
  64. <article class="asciidoctor">
  65. <h1>Configure Virtual Hosts</h1>
  66. <div class="paragraph">
  67. <p>Apache makes it easy to have multiple websites or web applications running on the same physical server, and access each using a custom domain name. This is known as <em>virtual hosting</em>, and each virtual host can be mapped to a different subdirectory of the server.</p>
  68. </div>
  69. <div class="paragraph">
  70. <p>This feature is especially useful in development scenarios, as it allows developers to isolate and access different applications using unique domain names. For example, the domains <em><a href="http://app01.localhost" class="bare">http://app01.localhost</a></em> and <em><a href="http://app02.localhost" class="bare">http://app02.localhost</a></em> could point to two separate applications on the same server. Or, you could create separate domains, such as <em><a href="http://client1/" class="bare">http://client1/</a></em>, <em><a href="http://client2/" class="bare">http://client2/</a></em> and so on, for multiple client websites hosted on the same server.</p>
  71. </div>
  72. <div class="admonitionblock note">
  73. <table>
  74. <tr>
  75. <td class="icon">
  76. <i class="fa icon-note" title="Note"></i>
  77. </td>
  78. <td class="content">
  79. Virtual hosts created in this manner will not be accessible from other systems, unless those systems are separately configured to associate the custom domain used by the virtual host with the IP address of the XAMPP server.
  80. This guide walks you through the process of setting up a new virtual host with XAMPP, by creating and configuring an example host named <em>wordpress.localhost</em> for a WordPress installation. It assumes that you have an existing WordPress installation at <em>C:\xampp\apps\wordpress\htdocs\</em> and accessible via the URL <a href="http://localhost/wordpress" class="bare">http://localhost/wordpress</a>.
  81. </td>
  82. </tr>
  83. </table>
  84. </div>
  85. <div class="admonitionblock tip">
  86. <table>
  87. <tr>
  88. <td class="icon">
  89. <i class="fa icon-tip" title="Tip"></i>
  90. </td>
  91. <td class="content">
  92. You can install WordPress with just a few clicks using the <a href="https://bitnami.com/stack/xampp#wordpress">Bitnami WordPress Module for XAMPP</a>.
  93. </td>
  94. </tr>
  95. </table>
  96. </div>
  97. <div class="paragraph">
  98. <p>Follow the steps below to create a virtual host:</p>
  99. </div>
  100. <div class="olist arabic">
  101. <ol class="arabic">
  102. <li>
  103. <p>Change to your XAMPP installation directory (typically, <em>C:\xampp</em>) and open the <em>httpd-vhosts.conf</em> file in the <em>apache\conf\extra\</em> subdirectory using your favourite text editor.</p>
  104. </li>
  105. <li>
  106. <p>Replace the contents of this file with the following directives:</p>
  107. <div class="literalblock">
  108. <div class="content">
  109. <pre>&lt;VirtualHost *:80&gt;
  110. DocumentRoot "C:/xampp/htdocs/"
  111. ServerName localhost
  112. &lt;/VirtualHost&gt;
  113. &lt;VirtualHost *:80&gt;
  114. DocumentRoot "C:/xampp/apps/wordpress/htdocs"
  115. ServerName wordpress.localhost
  116. &lt;/VirtualHost&gt;</pre>
  117. </div>
  118. </div>
  119. <div class="imageblock">
  120. <div class="content">
  121. <img src="./images/configure-vhosts/image1.png" alt="image1">
  122. </div>
  123. </div>
  124. <div class="paragraph">
  125. <p>This contains two virtual host configuration blocks:</p>
  126. </div>
  127. <div class="ulist">
  128. <ul>
  129. <li>
  130. <p>The first block is the default or fallback virtual host, which is used for all requests that are not matched by subsequent blocks.</p>
  131. </li>
  132. <li>
  133. <p>The second block sets up a virtual host named <em>wordpress.localhost</em>. The DocumentRoot directive specifies the directory to be used when serving requests for this virtual host (in this case, the WordPress installation directory), while the ServerName directive specifies the custom domain name for the virtual host.</p>
  134. </li>
  135. </ul>
  136. </div>
  137. <div class="paragraph">
  138. <p>To add more virtual hosts, simply duplicate the second virtual host block and modify the port number, DocumentRoot and ServerName directives as per your requirements. For example, if you want to use SSL with your custom domain name, you can add a new virtual host block for port 443.</p>
  139. </div>
  140. <div class="admonitionblock tip">
  141. <table>
  142. <tr>
  143. <td class="icon">
  144. <i class="fa icon-tip" title="Tip"></i>
  145. </td>
  146. <td class="content">
  147. If you plan to have a large number of virtual hosts with very similar configuration, consider using wildcard-based subdomains with your virtual hosts.
  148. </td>
  149. </tr>
  150. </table>
  151. </div>
  152. </li>
  153. <li>
  154. <p>Restart Apache using the XAMPP control panel for your changes to take effect.</p>
  155. <div class="imageblock">
  156. <div class="content">
  157. <img src="./images/configure-vhosts/image2.png" alt="image2">
  158. </div>
  159. </div>
  160. </li>
  161. <li>
  162. <p>At this point, your virtual host is configured. However, if you try browsing to the <em>wordpress.localhost</em> domain, your browser will show a failure notice, since this domain does not exist in reality. To resolve this, it is necessary to map the custom domain to the local IP address. To do this, open the file <em>C:\windows\system32\drivers\etc\hosts</em> and add the following line to it:</p>
  163. <div class="literalblock">
  164. <div class="content">
  165. <pre>127.0.0.1 wordpress.localhost</pre>
  166. </div>
  167. </div>
  168. <div class="imageblock">
  169. <div class="content">
  170. <img src="./images/configure-vhosts/image3.png" alt="image3">
  171. </div>
  172. </div>
  173. <div class="paragraph">
  174. <p>This takes care of mapping the <em>wordpress.localhost</em> domain name to the local machine, which always has the IP address 127.0.0.1.</p>
  175. </div>
  176. </li>
  177. </ol>
  178. </div>
  179. <div class="admonitionblock note">
  180. <table>
  181. <tr>
  182. <td class="icon">
  183. <i class="fa icon-note" title="Note"></i>
  184. </td>
  185. <td class="content">
  186. On some versions of Windows, you will not be able to edit the <em>C:\windows\system32\drivers\etc\hosts</em> file without administrator privileges. You can edit the file by right-clicking the Notepad icon and selected the "Run as administrator" menu option, then entering administrator credentials (if required) and clicking "OK" or "Yes" to proceed.
  187. </td>
  188. </tr>
  189. </table>
  190. </div>
  191. <div class="paragraph">
  192. <p>At this point, you should be able to enter the URL <a href="http://wordpress.localhost" class="bare">http://wordpress.localhost</a> in your browser&#8217;s address bar and see your WordPress installation. Here&#8217;s an example of what you should see:</p>
  193. </div>
  194. <div class="imageblock">
  195. <div class="content">
  196. <img src="./images/configure-vhosts/image4.png" alt="image4">
  197. </div>
  198. </div>
  199. </article>
  200. </div>
  201. </div>
  202. </div>
  203. <footer>
  204. <div class="row">
  205. <div class="large-12 columns">
  206. <div class="row">
  207. <div class="large-8 columns">
  208. <ul class="social">
  209. <li class="twitter"><a href="https://twitter.com/apachefriends">Follow us on Twitter</a></li>
  210. <li class="facebook"><a href="https://www.facebook.com/we.are.xampp">Like us on Facebook</a></li>
  211. <li class="google"><a href="https://plus.google.com/+xampp/posts">Add us to your G+ Circles</a></li>
  212. </ul>
  213. <ul class="inline-list">
  214. <li><a href="https://www.apachefriends.org/blog.html">Blog</a></li>
  215. <li><a href="https://www.apachefriends.org/privacy_policy.html">Privacy Policy</a></li>
  216. <li>
  217. <a target="_blank" href="http://www.fastly.com/"> CDN provided by
  218. <img width="48" data-2x="/dashboard/images/fastly-logo@2x.png" src="/dashboard/images/fastly-logo.png" />
  219. </a> </li>
  220. </ul>
  221. </div>
  222. <div class="large-4 columns">
  223. <p class="text-right">Copyright (c) 2015, Apache Friends</p>
  224. </div>
  225. </div>
  226. </div>
  227. </div>
  228. </footer>
  229. <!-- JS Libraries -->
  230. <script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
  231. <script src="/dashboard/javascripts/all.js" type="text/javascript"></script>
  232. </body>
  233. </html>