A malfunction of the website of a tool that we developed inspired me to write this post to whomever may need to do this. This entry is not meant to be exhaustive but it's more of a practical guide to setting up the Apache when I was making the webpage.
1) set up the VM with the system admin. If you have VirtualBox before, this works somewhat like it.
-- be sure to ask for root access.
2) all website content is presented in /var/www/html/
-- put soft links into this folder to direct to other folders if required
3) to make content public on the WWW, we need the switch on the Apache HTTP server. Imagine the Apache as a middle man between your console and the WWW, it 'advertises' your content on the WWW.
Use the following command:
$sudo \/sbin\/service httpd start
Replace 'start' with 'restart' to reboot and 'stop' to switch off.
We should see something like that to know that it is working (or not):
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using server.name.123 for ServerName
[ OK ]
[sudo] password for user123:
Reloading httpd: [ OK ]
4) Check on the WWW to see if the website is up. If it's not, debug using the Apache log file.
$less /var/log/httpd/error_log
This log file will tell you what is wrong and the IP of the client that was trying to access the site.
5) When you add files from your home directory, sometimes it doesn't appear on the website and the log file says that it couldn't access it.
First, make sure you have cleared your cache to see for sure you are looking at a refreshed page.
Second, go to your VM and check the permission of the file that you are looking at:
$ ls -alZ
-- this will help you check the permission and ownership of the files. (1) Apache should be able to read all of them; (2) configuration/permission should be: unconfined_u:object_r:httpd_sys_content_t:s0 not unconfined_u:object_r:user_home_t:s0
$ sudo chown apache:apache file.txt
-- solves (1)
$ sudo restorecon -r file.txt
-- solves (2)
6) Add this line to ensure that the HTTP server reboots together if the VM restarts
$ chkconfig httpd on
Things should be in order now.
No comments:
Post a Comment