1,234
edits
Changes
→Set up access to the web server
= Set up access to the web server =
Now that you have a web server set up with proper storage, it's almost time to test it using a web browser.
== Make a simple PHP webpage ==
First create a simple php webpage. * mkdir Look for the '''DocumentRoot''' setting in /etc/httpd/conf/httpd.conf. Note that it's set to '''/var/www/html'''* vi Create this directory.* Then create a plain-text file '''/var/www/html/index.php''' with the following contents:<source>
Hello. My web server still works.<br />
If this shows the current date and time, PHP works too:<br />
<?php system("date"); ?></source>* chown -R andrew /var/www/As a general security practice you should not work on web pages as root. Change the ownership of the htmldirectory and its contents so that your user can have full control of the website stuff.* systemctl Then start httpdApache and test your webpage by connecting to your server from your server using '''links''' as a client: [[File:AWSTestApacheLoopback.png|800px|border|center]] Note that this is a webpage, and it's loaded from localhost which means the web server works, but it's not the webpage you created (you can quit links with the 'q' key): [[File:AWSPHPMissing.png|800px|border|center]] The problem is that we created an index.php file which will load by default if your web server has the PHP module installed, but we didn't install that. * test with You can view your PHP page by specifying the path to it explicitly in the address:<source>[asmith15@ip-10-3-45-64 ~]$ linkshttp://localhost/index.php</source> [[File:AWSPHPMissing2.png|border|center]] * install That's better but still not quite right. Install the missing package ('''php, ''') and restart httpdApache.
== Port forwarding for HTTP ==