{"id":996,"date":"2013-10-31T15:43:09","date_gmt":"2013-10-31T22:43:09","guid":{"rendered":"http:\/\/jim-zimmerman.com\/?p=996"},"modified":"2013-10-31T17:14:38","modified_gmt":"2013-11-01T00:14:38","slug":"ubuntu-apache-and-using-hostnames-instead-of-directories-for-sites","status":"publish","type":"post","link":"https:\/\/jim-zimmerman.com\/?p=996","title":{"rendered":"Ubuntu, apache and using hostnames instead of directories for sites."},"content":{"rendered":"<p>OS: Ubunutu 12.x<br \/>\nWeb server: apache 2.x<\/p>\n<p>So here is what I was trying to accomplish.  I have a server with many sites in their own directories.  I had one that I wanted to just use a hostname to access it.  Now, I have done this many times in CentOS\/Redhat, but never in Ubuntu, and it adds a little twist to the process.  First the name needed to be added to the DNS.  I created a CNAME, since I already had a name in for the server.  <\/p>\n<p>Then:<\/p>\n<blockquote><p>vi \/etc\/apache2\/apache2.conf<br \/>\n&#8230;<br \/>\nNameVirtualHost *:80<br \/>\n&lt;IfModule mod_ssl.c&gt;<br \/>\n&nbsp;NameVirtualHost *:443<br \/>\n&lt;\/IfModule&gt;<br \/>\n&#8230;<\/p>\n<p>cd \/etc\/apache2\/sites-available<br \/>\n&lt;\/blockquote&gt;<\/p>\n<p>Created a file with a descriptive name of my site:<\/p>\n<blockquote><p>vi some.hostname.com<\/p><\/blockquote>\n<p>Added the following as appropriate for my site:<\/p>\n<blockquote><p>&lt;VirtualHost *:80&gt;<br \/>\n&nbsp;ServerName some.hostname.com<br \/>\n&nbsp;ServerAlias some<br \/>\n&nbsp;DocumentRoot \/var\/www\/some<br \/>\n&lt;\/VirtualHost&gt;<\/p><\/blockquote>\n<p>There are many other options you can add here, but this is where I started.<\/p>\n<blockquote><p>cd \/etc\/apache2\/site-enabled<br \/>\nln -s ..\/sites-avaiable\/some.hostname.com<br \/>\nservice apache2 restart<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>OS: Ubunutu 12.x Web server: apache 2.x So here is what I was trying to accomplish. I have a server with many sites in their own directories. I had one that I wanted to just use a hostname to access it. Now, I have done this many times in CentOS\/Redhat, but never in Ubuntu, and [&#038;hellip<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[120,274,339],"class_list":["post-996","post","type-post","status-publish","format-standard","hentry","category-documentation","tag-apache","tag-hostname","tag-ubunutu"],"share_on_mastodon":{"url":"","error":""},"_links":{"self":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/996","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=996"}],"version-history":[{"count":12,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/996\/revisions"}],"predecessor-version":[{"id":1008,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/996\/revisions\/1008"}],"wp:attachment":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=996"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=996"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}