{"id":1857,"date":"2014-02-26T15:33:21","date_gmt":"2014-02-26T15:33:21","guid":{"rendered":"http:\/\/blog.designed79.co.uk\/?p=1857"},"modified":"2014-02-26T15:34:10","modified_gmt":"2014-02-26T15:34:10","slug":"how-to-protect-a-non-apache-webserver-with-apache","status":"publish","type":"post","link":"https:\/\/blog.designed79.co.uk\/?p=1857","title":{"rendered":"How to protect a non Apache Webserver with Apache"},"content":{"rendered":"<p>If you have a service that does not have any authentication, such as Margarita, its easy to do using OS X&#8217;s built in Apache<\/p>\n<p>Make a plan site in Server.app.  Give it the port you want.<\/p>\n<p>Then go and edit the site config file.  These are stored in \/etc\/apache2\/sites in 10.7 and in \/Library\/Server\/Web\/Config\/apache2\/sites in 10.8 and 10.9<\/p>\n<p>Your looking for a file that matches you site, like 0000_any_8100_test.com.conf<\/p>\n<p>edit the file<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;height:300px;\"><div class=\"text codecolorer\">&lt;VirtualHost *:8100&gt;<br \/>\n&nbsp; &nbsp; ServerName test.com<br \/>\n&nbsp; &nbsp; ServerAdmin admin@example.com<br \/>\n&nbsp; &nbsp; DocumentRoot &quot;\/Library\/Server\/Web\/Data\/Sites\/CustomSitesDefault&quot;<br \/>\n&nbsp; &nbsp; DirectoryIndex index.html index.php \/wiki\/ default.html<br \/>\n&nbsp; &nbsp; CustomLog \/var\/log\/apache2\/access_log combinedvhost<br \/>\n&nbsp; &nbsp; ErrorLog \/var\/log\/apache2\/error_log<br \/>\n&nbsp; &nbsp; ProxyPass \/ http:\/\/127.0.0.1:8089\/<br \/>\n&nbsp; &nbsp; &lt;Location \/&gt;&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; AuthUserFile \/Library\/Server\/Web\/Data\/Sites\/CustomSitesDefault\/htpass<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; AuthName &quot;Authorisation Required&quot;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; AuthType Basic<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; require valid-user&nbsp; <br \/>\n&nbsp; &nbsp; &lt;\/Location&gt; <br \/>\n&nbsp; &nbsp; &lt;IfModule mod_ssl.c&gt;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; SSLEngine Off<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; SSLCipherSuite &quot;ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM&quot;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; SSLProtocol -ALL +SSLv3 +TLSv1<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; SSLProxyEngine On<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; SSLProxyProtocol -ALL +SSLv3 +TLSv1<br \/>\n&nbsp; &nbsp; &lt;\/IfModule&gt;<br \/>\n&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &lt;Directory &quot;\/Library\/Server\/Web\/Data\/Sites\/CustomSitesDefault&quot;&gt;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; Options All +MultiViews -ExecCGI -Indexes<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; AllowOverride None<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &lt;IfModule mod_dav.c&gt;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DAV Off<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &lt;\/IfModule&gt;<br \/>\n&nbsp; &nbsp; &lt;\/Directory&gt;<br \/>\n<br \/>\n&lt;\/VirtualHost&gt;<\/div><\/div>\n<p>What your adding is this<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"text codecolorer\">&nbsp; &nbsp; ProxyPass \/ http:\/\/127.0.0.1:8089\/<br \/>\n&nbsp; &nbsp; &lt;Location \/&gt;&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; AuthUserFile \/Library\/Server\/Web\/Data\/Sites\/CustomSitesDefault\/htpass<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; AuthName &quot;Authorisation Required&quot;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; AuthType Basic<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; require valid-user&nbsp; <br \/>\n&nbsp; &nbsp; &lt;\/Location&gt;<\/div><\/div>\n<p>The ProxyPass is setting up mod_proxy ,make sure this is loaded in your main httpd.conf, to forward all requests \/ to a server on localhost:8089<\/p>\n<p>The Location section is then setting for a basic auth password for any access of \/ <\/p>\n<p>Make sure you have set a user and password using htpasswd and that the file can be read by apache<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you have a service that does not have any authentication, such as Margarita, its easy to do using OS X&#8217;s built [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1857","post","type-post","status-publish","format-standard","hentry","category-info-on-tech"],"_links":{"self":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1857","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1857"}],"version-history":[{"count":0,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1857\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}