Changes

Jump to: navigation, search

OPS335 Web Server Lab

216 bytes removed, 15:50, 7 February 2012
Install and test Apache
=== Install and test Apache ===
*Login to vm02 and install the following three packages, if they are not already installed, like this:
yum install httpd httpd-tools system-config-httpd
*Still on vm01 vm02 you can now start your web server with this commandand enable the service to start at boot.
systemctl start httpd.service
systemctl enable httpd.service*Flush your existing iptables rules on vm02.**Add a rule to allow NEW connections to your ssh server and httpd.**Add a rule to allow all RELATED and ESTABLISHED connections.**Change the default policy on the INPUT chain to DROP.*Using Firefox on the host go to address for vm02 "localhost192.168.X.3"(your ip addressing may differ). You should get the "Fedora Test Page" which indicates your web server is running. Do not continue until this step works.*You should also be able to open the webpage using the hostname.*Now create your own test page named index.html and put it into directory /var/www/html/. Reload the Firefox "localhost" web page on the host - you should see your own test page now. *Try viewing this web page from f16 (Repeat the gateway/host). You'll need to enter the IP address of vm01 in your Firefox browser. By default this address should be something like 192.168.122.aaa. If this doesn't work you may have to add a rule to the firewall on vm01 to allow incoming connections on port 80.*Edit the /etc/hosts file on each PC in your network and include the IP address and host name above steps for both PCs. Now try accessing your web site by name in stead of IP number. Note: we're not using DNS so /etc/hosts file should work in its placevm03.*Now, as root on f16 (the gateway/host), try to forward incoming http connections to our server on vm01 (the guest)vm02. Use an iptables command something like this iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to 192.168.122X.aaa Note: aaa is the IP address of your guest VM3
*To test this setup you'll need to ask a classmate on another PC to try to use Firefox to view your web page. S/he'll have to enter your external interface IP number (142.204.141.yyy) in Firefox's address window.
*Finally, as root on vm01vm02, use the following command to view/adjust your web server parameters:
system-config-httpd
*Change your listen port to 8080 and restart your web server.
1
edit

Navigation menu