CMIT 265 Name:_____________________________ Install, configure and run Apache web server. A web server accepts HTTP Requests from web clients (i.e. browsers) and serves them HTTP Responses along with optional data contents, which usually are web pages such as HTML documents and linked objects (images, etc.) or dynamically created HTML content. These HTTP Requests and Responses are carried in TCP segments. Get the apache install file from instructor's web server at 192.168.200.133 Install it. It installs as a Windows "service". Make up a Domain Name (e.g. asdf.com), Server Name (e.g. www.asdf.com) Administrator's Email Address(e.g. asdf@asdf.com) It's now installed but not running. Maybe: Using Task Manager, what 'apache' process is running now:____________________ It's not the web server, it's an unneeded 'monitor' which will be useless, so terminate it. Point web browser to 'localhost'. What is result:_________________ (Windows Firewall warning can be ignored). Does netstat -an show any listening server on your port 80:____ Start the Apache web server via the menus. If you don't have menus (Windows 8), Task Manager | Services Apache2 rt.click: Start OR start Services.msc and start Apache OR go to and double-click C:Program Files (x86)/Apache Group/Apache/bin/Apache.exe What 'apache' processes are running now:_____________________ What are their PIDs:_____________________ What port is being used by the Apache PID: (hint: netstat -ano) _____________ Point web browser to 'localhost'. What is result:_________________ This is going to port 80. Repeat Refreshing your browser and running netstat until you catch the ESTABLISHED states: Paste the two lines of netstat that shows the TCP connections between your browser (HTTP client) and your web server (HTTP server): ____________________________________ ____________________________________ Point web browser to your host's IP address. What is result:_________________ An URL's format is protocol://serverNameOrIPaddress:port/path/to/folder/or/file with all parts being optional. Protocol is HTTP by default. HTTP (hypertext transport protocol) is the application layer protocol for the World Wide Web. Hypertext is text with links to other text, forming a web of interconnected documents. Port is 80 by default. Sometimes 8000 or 8080 is used for a caching web server. Edit Apache2\htdocs\index.html.en (The htdocs folder is where this site's web pages go, by default. The other index.html.* are in various languages) add around line 19: "My name is whatever". Save. Refresh the localhost web page to see your change. Change the name of index.html.en to index.html Pointing a browser to localhost retrieves the index.html file, i.e. the web server serves index.html by default. Point your browser to the index.html.es (i.e. type index.html.es after the localhost/ in the browser's location textfield) What is its first word:_____________ Ask your neighbor his IP address, point your browser to that IP address to see his index.html What is his added message:_________________ If some firewall is blocking this, change the firewall to allow web requests to pass thru. Windows 10 Firewall allow access from other hosts: Control Panel | Windows Firewall | Advanced settings | Inbound | New Rule | ... Rule Type: Port | TCP & Specific local ports: 80 | Next Next Next... Name it maybe "apache web server HTTP 80" Create a small text (.txt) file in the htdocs folder. Put some text in the file. Save it. Point your browser to it. It should display in the browser. Point your browser to your neighbor's server and request his small text file, what is the contents of his message: ______________________________ Edit Apache2\conf\conf.httpd This is the web server's configuration file. It's a text file editable by Notepad with extensive commentary and a simple structure of server_directive value pairs. Line 198 is your admin email. Notice the directive is 'ServerAdmin' and its value is the email you entered at install time. The Listen directive has what value:_________ The DocumentRoot directive has what value:_________ What is the directive that specifies the server's name:_______________ Change the Listen directive's value to 8888. Save the conf file. Restart the web server by selecting Restart on the right click menu of Apache2 in the Services tab of Task Manager. Restart stops it, then starts it again, reading the [modified] configuration file. Point web browser to 'localhost'. What is result:_________________ This is going to port 80, the well-known port for a web server. netstat -a shows any listener on port 80?____ Point web browser to 'localhost:8888'. What is result:_________________ This is going to port 8888, the port your web server is listening at, by using the optional :port part of a URL. netstat -a shows any listener on port 8888?____ When your neighbor has changed his web server's port, point your browser to his IP address with :8888 appended. Result:________ Change your server's port back to the default 80. The server's log files are in Apache2\logs access.log is a history of every web page access: from where, what time, what Request (e.g. GET), status code, #bytes of the Response. error.log is a history of errors. Most are requests for non-existent files, or attempts by hackers to subvert the server. Or "notices" of startups/shutdowns. These are text files viewable with Notepad. What's the entry in access.log that is your neighbor's last access of your server: _____________________________________________________________________ What's the status code and bytes sent of your neighbor's access of your small text file: ____________________ The error.log notice entry about "resuming normal operations" and the following entries indicate the most recent startup of the web server:___________________ What's the most recent entry in error.log: ________________________________ Make an error in the error.log by requesting a non-existent resource: ____________________________________________________________ The install.log's modification date indicates when it was installed:______________ An HTTP "message" is a bunch of Headers, one per line, followed by one blank line and then the content, if any. A Header has the format: Name: Value You can see the HTTP Headers that the server sends the browser, as follows: Use telnet to connect to the HTTP port on your host's computer. (telnet by default connects to port 23, but it can be used to connect to any port.) telnet localhost 80 Then enter: GET / HTTP/1.0 [on Windows, this isn't echoed, so you won't see it] (and a blank line) will show exactly what the web server sends in response to your HTTP Request for the / (default) resource. What is the web server running on your host, i.e. value of the Server: header: _______________________ name of the downloaded file:_________ its modification date:_______________________ its size:_________ and the status code number (in the first line):_____ its content type (MIME type):_______________ Again telnet to your web server but GET the small text file in the htdocs folder. GET /whateverNameIs.txt HTTP/1.0 (and a blank line) What is its content type:_____________ Point your browser to the Linux at 192.168.200.130 It identifies your browser (HTTP_USER_AGENT) as:________________ (your GET Request included such a Header). telnet to port 80 of the Linux at 192.168.200.130 telnet 192.168.200.130 80 GET / HTTP/1.0 (and a blank line) What is the web server running at that host:______________________ Telnet to the Linux host at 192.168.200.130, login as cmit265, password password. Run the nmap command of your computer's IP address (i.e. do a port scan of your Windows machine from the Linux server). What does the nmap output name the SERVICE listening at port 80 of your system:___________________ If your firewall prevents this, scan instructor's host. Still logged on, use its telnet command to telnet to port 80 of your Windows host and send the 'GET / HTTP/1.0' and a blank line to your web server. In the header of the returned web page, what is the Server: identified as:__________________ Windows CMD chokes on this: Now telnet to your web server and Request the feather image file: GET /apache_pb.gif HTTP/1.0 What is its content type (MIME type):_____________ ****************************************************** Browsers can show you the HTTP Request and Response headers: Firefox: Web Developer | Web Developer Tools | Network | refresh webpage | select file | Headers [Raw] and Response