{"id":12,"date":"2013-01-26T06:48:07","date_gmt":"2013-01-26T06:48:07","guid":{"rendered":"http:\/\/murraymurray.dyndns-home.com\/blog\/?p=12"},"modified":"2013-01-26T06:48:07","modified_gmt":"2013-01-26T06:48:07","slug":"apache-setup","status":"publish","type":"post","link":"https:\/\/goblinpeasant.com\/blog\/apache-setup\/","title":{"rendered":"Apache Setup"},"content":{"rendered":"<figure style=\"width: 600px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"http:\/\/www.old-picture.com\/indians\/pictures\/Apache-Warrior.jpg\" width=\"600\" height=\"780\" \/><figcaption class=\"wp-caption-text\">His Website Will Outfrown Yours<\/figcaption><\/figure>\n<p>Apache is remarkably easy to get running. \u00a0It is all governed by the service daemon \u201chttpd\u201d and can be installed easily with a yum or apt-get install command if it didn\u2019t come packaged with your distribution. \u00a0Any repository that was preinstalled should have it easily available. \u00a0The yum command in CentOS would be:<\/p>\n<p>yum install httpd<\/p>\n<p>The configuration file is easy to edit with the command:<\/p>\n<p>vim \/etc\/httpd\/conf\/httpd.conf<\/p>\n<p>Almost everything you could need for a simple webserver is already set up for you, and already configured. \u00a0The two simplest edits you can change would be the port(s) Apache listens on and the DocumentRoot setting that tells the service what local directory on the server itself will act as the root directory for web pages.<\/p>\n<p>You can change it from listening from port 80 to any other valid TCP port by finding the line that says \u201cListen 80\u2033 \u00a0and changing it to \u201cListen &lt;xxx&gt;\u201d where &lt;xxx&gt; would just be whatever port you want to try. \u00a0If you wanted port 3005 you would change the line to say, \u201cListen 3005\u2033 and save the file.<br \/>\nJust as a side note for alternate ports, the assumed port for http url browsing is port 80. \u00a0It\u2019s implied in all standard browsers that when you access a url or an ip of a webserver that it is to be done over port 80, unless directly told otherwise. \u00a0The method for accessing a url or ip over a specific port is to enter the url\/ip like so http:\/\/&lt;ip_or_url&gt;:&lt;port&gt;<\/p>\n<p>For example, accessing your loopback ip over port 3005 would work as such in a browser:<\/p>\n<p>http:\/\/127.0.0.1:3005<\/p>\n<p>This will access your DocumentRoot folder on the webserver, and will normally allow you to access any file inside that directory that the Apache service has access to. \u00a0The browser used to access the file will in large measure determine how that file is accessed.<\/p>\n<p>DocumentRoot configuration is just as simple. \u00a0The default directory for CentOS is \/var\/www\/html but you may want to change that for whatever reason. \u00a0It\u2019s easy to change that by doing the same vim command as above and changing the line that starts with DocumentRoot \u201c\/var\/www\/html\u201d to use whatever directory you prefer that Apache has access to.<\/p>\n<p>For example, if you wanted Apache to access \/home\/myuser\/webfiles you would change the line to look like so:<\/p>\n<p>DocumentRoot \u201c\/home\/myuser\/webfiles\u201d<\/p>\n<p>Any time you make a change to the http.conf file and you want to see its effects, you\u2019ll need to restart the httpd service like so:<\/p>\n<p>service httpd restart<\/p>\n<p>Once the service is restarted, you should see any changes immediately when you access it from a browser.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apache is remarkably easy to get running. \u00a0It is all governed by the service daemon \u201chttpd\u201d and can be installed easily with a yum or apt-get install command if it didn\u2019t come packaged with your distribution. \u00a0Any repository that was preinstalled should have it easily available. \u00a0The yum command in CentOS would be: yum install [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":28,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[7,21],"class_list":["post-12","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-website-admin","tag-apache","tag-web"],"_links":{"self":[{"href":"https:\/\/goblinpeasant.com\/blog\/wp-json\/wp\/v2\/posts\/12","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/goblinpeasant.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/goblinpeasant.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/goblinpeasant.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/goblinpeasant.com\/blog\/wp-json\/wp\/v2\/comments?post=12"}],"version-history":[{"count":0,"href":"https:\/\/goblinpeasant.com\/blog\/wp-json\/wp\/v2\/posts\/12\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/goblinpeasant.com\/blog\/wp-json\/wp\/v2\/media\/28"}],"wp:attachment":[{"href":"https:\/\/goblinpeasant.com\/blog\/wp-json\/wp\/v2\/media?parent=12"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/goblinpeasant.com\/blog\/wp-json\/wp\/v2\/categories?post=12"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/goblinpeasant.com\/blog\/wp-json\/wp\/v2\/tags?post=12"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}