Difference between revisions of "Apache"

From Alpine Linux
Jump to: navigation, search
(Testing)
m (New category: Web Server)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Installing Apache==
+
== Simple Setup ==
Add the Apache2 package with the command:
 
  
{{Cmd|#apk add apache2}}
+
* Add the apache2 package with {{Codeline|apk add apache2}}
 +
* Start the service with {{Codeline|rc-service apache2 start}}
 +
* Navigate a browser to the machine's address; there you should see the default "It works" page
 +
* Consider permanently enabling apache on startup with {{Codeline|rc-update add apache2}}
 +
* Edit the configuration in {{Path|/etc/apache2/}}, then run {{Codeline|rc-service apache2 restart}} to enable your changes
 +
* Consult the official documentation https://httpd.apache.org/docs/2.4/
  
== Testing ==
+
[[Category:Web Server]]
 
 
Move to the directory where your site will resides:
 
 
 
{{Cmd|#cd /var/www/localhost/htdocs}}
 
 
 
And create an index.html file to test if everything is ok:
 
 
 
{{Cmd|#vi index.html}}
 
 
 
And add the following lines:
 
 
 
{{Cmd|<html>
 
<head>
 
<title> My first page </title>
 
</head>
 
<body>
 
It works!
 
</body>
 
</html>}}
 
 
 
That done, let us start apache2 web server:
 
 
 
{{Cmd|rc-service apache2 start}}
 
 
 
Now access: http://<ip_address> and if everything is ok you will see the html page.
 
 
 
== Ending ==
 
 
 
Finally let us set up apache2 to start on operating system startup:
 
 
 
{{Cmd|rc-update add apache2}}
 
 
 
Now you can create your html site and host in this directory.
 

Latest revision as of 03:27, 21 September 2017

Simple Setup

  • Add the apache2 package with apk add apache2
  • Start the service with rc-service apache2 start
  • Navigate a browser to the machine's address; there you should see the default "It works" page
  • Consider permanently enabling apache on startup with rc-update add apache2
  • Edit the configuration in /etc/apache2/, then run rc-service apache2 restart to enable your changes
  • Consult the official documentation https://httpd.apache.org/docs/2.4/