{"id":116,"date":"2011-09-28T12:20:04","date_gmt":"2011-09-28T12:20:04","guid":{"rendered":"http:\/\/wiki.davelevy.info\/?p=116"},"modified":"2023-01-18T15:46:04","modified_gmt":"2023-01-18T15:46:04","slug":"apache","status":"publish","type":"post","link":"https:\/\/davelevy.info\/wiki\/apache\/","title":{"rendered":"Apache"},"content":{"rendered":"<p>Here are some notes on using apache. This talks, a bit about Access Control and redirection. I need to test if any of this content was duplicated elsewhere in the site.<!--more--><\/p>\n<h4>Access Control and Authentication<\/h4>\n<p>I have built a LAMP server that would benefit from having some front-page access control and authentication. I have looked up the following links;<\/p>\n<ol>\n<li>http:\/\/httpd.apache.org\/docs\/2.2\/mod\/mod_authnz_ldap.html, which needs an LDAP server, <a title=\"on this wiki\" href=\"https:\/\/davelevy.info\/wiki\/openldap\/\">https:\/\/davelevy.info\/wiki\/openldap\/<\/a><\/li>\n<li>http:\/\/httpd.apache.org\/docs\/2.2\/mod\/mod_auth_basic.html<\/li>\n<li>http:\/\/httpd.apache.org\/docs\/2.2\/mod\/mod_auth_digest.html<\/li>\n<li>http:\/\/httpd.apache.org\/docs\/2.2\/mod\/mod_authn_file.html<\/li>\n<li>http:\/\/httpd.apache.org\/docs\/2.2\/mod\/mod_authn_dbm.html<\/li>\n<\/ol>\n<h4>Priority between redirect and proxy directives<\/h4>\n<p>In July 2013, I transferred <a title=\"the new wordpress version of my Rogan's Trial Version\" href=\"https:\/\/davelevy.info\/wiki\/nwn-rolgans-trial\/\">Rogan&#8217;s Trial<\/a> from Snipsnap to WordPress, i.e. here.\u00a0Snipsnap is served via a Jetty server on port 8668 and the <a title=\"documents how to configure apache as a proxy server for snipsnap\" href=\"https:\/\/davelevy.info\/wiki\/apache-as-a-proxy-server-for-snipsnap\/\">apache demon works as a Proxy<\/a>. My original wiki source was on the Google front page so I thought I&#8217;d 301 it, and redirect to the new site\/page.\u00a0 I made a bunch of incomplete notes about how to invoke apache redirection commands for use with a snipsnap server. In March 2015 I transferred these to the page comments. When I exited Snipsnap, I created a global 301 for the site.<\/p>\n<h3>On https redirections<\/h3>\n<ol>\n<li>How-to-redirect-http-to-https-using-htaccess\/amp\/, from freecodecamp on using .htaccess<\/li>\n<li><a href=\"https:\/\/stackoverflow.com\/questions\/4083221\/how-to-redirect-all-http-requests-to-https-using-htaccess-rules\">how-to-redirect-all-http-requests-to-https-using-htaccess-rules<\/a>, from stack exchange which recommends the use of virtual server configurations, although it seems they <a href=\"https:\/\/stackoverflow.com\/questions\/4083221\/how-to-redirect-all-http-requests-to-https-using-htaccess-rules\/21798882#21798882\">changed their mind<\/a>.<\/li>\n<li>And from Apache,\u00a0<a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/howto\/htaccess.html\">htaccess.html<\/a>\u00a0and the\u00a0<a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/mod\/core.html#directory\">directory<\/a>\u00a0command, which goes in the virtual host file.<\/li>\n<li>Dreambot also has <a href=\"https:\/\/help.dreamhost.com\/hc\/en-us\/articles\/215747748-How-can-I-redirect-and-rewrite-my-URLs-with-an-htaccess-file-\">some useful examples<\/a>.<\/li>\n<li><a href=\"https:\/\/htaccessbook.com\/htaccess-redirect-https-www\/\">https:\/\/htaccessbook.com\/htaccess-redirect-https-www\/<\/a><\/li>\n<li><a href=\"https:\/\/serverfault.com\/questions\/520195\/how-does-servername-and-serveralias-work\">https:\/\/serverfault.com\/questions\/520195\/how-does-servername-and-serveralias-work<\/a><\/li>\n<\/ol>\n<p>I found <a href=\"https:\/\/linux.die.net\/man\/8\/apachectl\">apachectl<\/a> configtest which is bloody marvellous<\/p>\n<h4>What I did,<\/h4>\n<p>I wrote an .htaccess command set, <a href=\"https:\/\/www.freecodecamp.org\/news\/how-to-redirect-http-to-https-using-htaccess\/amp\/\">guided by freecodecamp<\/a> and placed it in the webroot directory. I then amended the secure server vhost file to enable the use of htaccess; it&#8217;s default behaviour is off. The following ensures that http old server name := the https new server.<\/p>\n<pre>RewriteEngine On\r\nRewriteCond %{SERVER_PORT} 80\r\nRewriteRule ^(.*)$ https:\/\/dfl\\.ddns\\.net\/$1 [R,L]\r\n<\/pre>\n<p>and<\/p>\n<pre>&lt;Directory \/var\/www\/html&gt;\r\n        Options Indexes FollowSymLinks MultiViews\r\n        AllowOverride All\r\n        Order allow,deny\r\n        allow from all\r\n&lt;\/Directory&gt;\r\n<\/pre>\n<p>I need to fix the https old server name to new name. This may <a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/rewrite\/remapping.html\">need an if statement<\/a> in the 433 virtual host file. See also <a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/howto\/htaccess.html\">this<\/a>,\u00a0 <a href=\"https:\/\/httpd.apache.org\/docs\/current\/rewrite\/avoid.html#redirect\">this<\/a>, and <a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/rewrite\/\">this<\/a> from apache.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here are some notes on using apache. This talks, a bit about Access Control and redirection. I need to test if any of this content was duplicated elsewhere in the site.<\/p>\n","protected":false},"author":1,"featured_media":2449,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","_share_on_mastodon":"0"},"categories":[27,3],"tags":[77,78,920,911],"class_list":["post-116","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","category-technology","tag-apache","tag-redirect","tag-software","tag-technology"],"share_on_mastodon":{"url":"","error":""},"jetpack_featured_media_url":"https:\/\/davelevy.info\/wiki\/wp-content\/uploads\/2015\/02\/mante-asf-pb.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/posts\/116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/comments?post=116"}],"version-history":[{"count":8,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/posts\/116\/revisions"}],"predecessor-version":[{"id":11837,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/posts\/116\/revisions\/11837"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/media\/2449"}],"wp:attachment":[{"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/media?parent=116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/categories?post=116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/tags?post=116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}