Apache: Difference between revisions

From Alpine Linux
Line 1: Line 1:
== Installing Apache + PHP ==
== Installing Apache==
Add the main packages with the command:
Add the Apache2 package with the command:


{{Cmd|#apk add apache2 php-apache2}}
{{Cmd|#apk add apache2}}
 
== Testing ==


Move to the directory where your site will resides:
Move to the directory where your site will resides:
Line 10: Line 8:
{{Cmd|#cd /var/www/localhost/htdocs}}
{{Cmd|#cd /var/www/localhost/htdocs}}


Create an index.php file to test if everything is ok:
And create an index.html file to test if everything is ok:


{{Cmd|#vi index.php}}
{{Cmd|#vi index.html


And add the following lines:
<html>
 
<head>
{{Cmd|<?php
<title> My first page </title>
phpinfo();
</head>
?>}}
<body>
<h1>It works!</h1>
</body>
</html>


That done, let us start apache2 web server:
That done, let us start apache2 web server:
Line 24: Line 25:
{{Cmd|rc-service apache2 start}}
{{Cmd|rc-service apache2 start}}


Now access: http://<ipa_ddress> and if everything is ok you will see the php info page.
Now you can create your html site and host in this directory.
 
== Ending ==
 
Finally let us set up apache2 to start on operating system startup:
 
{{Cmd|rc-update add apache2}}
 
Now you can create your php site and host in this directory.

Revision as of 16:06, 27 December 2013

Installing Apache

Add the Apache2 package with the command:

#apk add apache2

Move to the directory where your site will resides:

#cd /var/www/localhost/htdocs

And create an index.html file to test if everything is ok:

{{Cmd|#vi index.html

<html> <head> <title> My first page </title> </head> <body>

It works!

</body> </html>

That done, let us start apache2 web server:

rc-service apache2 start

Now you can create your html site and host in this directory.