LING 408/508: Programming for Linguists Lecture 17 October 28 th.

Slides:



Advertisements
Similar presentations
Dan Fleck.  WAMP – Windows Apache MySQL PHP -  LAMP – Linux Apache MySQL PHP ◦ There are.
Advertisements

1 Configuring Internet- related services (April 22, 2015) © Abdou Illia, Spring 2015.
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
SELinux (Security Enhanced Linux) By: Corey McClurg.
Configuring Apache Server and Perl for CGI T.A. Maisa Khudair Dr. Qusai Abu Ein.
Chapter Apache Installation in Linux- Mandrake. Acknowledgment The following information has been obtained directly from
CP476 Internet Computing Browser and Web Server 1 Web Browsers A client software program that allows you to access and view Web pages on the Internet –Examples.
LING 408/508: Programming for Linguists Lecture 16 October 16 th.
APACHE SERVER By Innovationframes.com »
Making Your Web Page Interactive with CGI TLN Technology Committee February 16, 1999.
Virtual Hosts The apache server can handle multiple “web sites” at a time – a web service provider company may have multiple different sites to offer (see.
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
Setting up Greenstone for your organization Course material prepared by Greenstone Digital Library Project University of Waikato, New Zealand andNational.
CGI Common Gateway Interface. CGI is the scheme to interface other programs to the Web Server.
The Linux Operating System Lecture 5: Apache Tonga Institute of Higher Education.
1 Homework / Exam Exam 3 –Solutions Posted –Questions? HW8 due next class Final Exam –See posted schedule Websites on UNIX systems Course Evaluations.
LING 408/508: Programming for Linguists Lecture 17 October 21 st.
Web Servers Installation and Configuration May 24, 2001 CIS System Administration Problem Statement The class topic is setting up a Linux server to support.
Apache Server The Apache Server Apache is a WWW server that implements the HTTP protocol. Apache runs as a daemon. This means that it is a resident.
UNIX command line. In this module you will learn: What is the computer shell What is the command line interface (or Terminal) What is the filesystem tree.
An introduction to Apache. Different Types of Web Servers Apache is the default web server for may Unix servers. IIS is Microsoft’s default web server.
Unix Basics Chapter 4.
LIN Unix Lecture 3 Hana Filip. LIN UNIX Resources UNIX Tutorials UNIX help for.
LING 408/508: Programming for Linguists Lecture 3 August 31 st.
Introduction to Programming the WWW I CMSC Summer 2004 Lecture 6.
1 Apache. 2 Module - Apache ♦ Overview This module focuses on configuring and customizing Apache web server. Apache is a commonly used Hypertext Transfer.
CSU - DCE Advanced Perl CGI Operation - Fort Collins, CO Copyright © XTR Systems, LLC Introduction to the Common Gateway Interface (CGI) on the.
HTML Hyper Text Markup Language A simple introduction.
Introduction to Bash Programming Ellen Zhang. Previous three classes What have we learnt so far ?
Scripting Languages Course 2 Diana Trandab ă ț Master in Computational Linguistics - 1 st year
LING 408/508: Programming for Linguists Lecture 4 September 2 nd.
CGI Common Gateway Interface. CGI is the scheme to interface other programs to the Web Server.
Cosc 4750 Configuring httpd, Mysql, And Samba. defaults By default httpd demean will startup and work User directories are turned off Default directory.
Install Appaserver ©Tim Riley. Apache Group ©Tim Riley Add yourself to the apache group. Both the apache user and group are called “www-data”. This step.
Multi-Domain Hosting Hosting multiple domains on one server using Apache John Beckett 1/16/2013.
WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages.
LING 408/508: Programming for Linguists Lecture 8 September 23 rd.
LING 408/508: Programming for Linguists Lecture 18 November 2 nd.
Executable scripts. So far We have made scripts echo hello #for example And called it hello.sh Run it as sh hello.sh This only works from current directory?
LING 408/508: Programming for Linguists Lecture 16 October 26 th.
2 Manual & Filestore Mauro Jaskelioff. Introduction Using the manual The UNIX filestore File permissions.
More than one site? Use multiple configuration files Use multiple configuration files  httpd –d {path}  Assumes “conf/httpd.conf” Logging transactions.
Lab 8 Overview Apache Web Server. SCRIPTS Linux Tricks.
PHP Syntax You cannot view the PHP source code by selecting "View source" in the browser - you will only see the output from the PHP file, which is plain.
CS 330 Class 8 Homework A pattern that contains a word with an optional period A pattern that contains Fred with a space (not Freddy) See regexp.txt guest4.htm.
BIF703 File Permissions. As you recall from our previous notes, that Unix/Linux recognizes everything as a file: Regular files to store data, programs,
 Prepared by: Eng. Maryam Adel Abdel-Hady
Unix Lab Fall Shell Scripting ●Through the shell (LXTerminal) you can: ●Run programs. ●Interact with the file system. ●Change settings. ●Send/receive.
Multi-Domain Hosting CPTE 212 “Missing Slides” for 1/22/2015 John Beckett.
Building Your Own Website Using:. Install & configure LAMP. Download WordPress and run it as a local website on your Raspberry Pi. Configure WordPress.
Apache Web Server v. 2.2 Reference Manual Chapter 2 Starting Apache.
9/21/04 James Gallagher Server Installation and Testing: Hands-on ● Install the CGI server with the HDF and FreeForm handlers ● Link data so the server.
L.A.M.P. İlker Korkmaz & Kaya Oğuz CS 350. Why cover a lecture on LAMP? ● Job Opportunities – There are many hosting companies offering LAMP as a web.
Using Linux Kaya Oğuz Room: 310.
Installing iHRIS Install iHRIS Manage on an Ubuntu System
Linux 101 Training Module Linux Basics.
Unix System Administration
Lab 1 introduction, debrief
INSTALLING AND SETTING UP APACHE2 IN A LINUX ENVIRONMENT
LING 408/508: Computational Techniques for Linguists
LING 408/508: Computational Techniques for Linguists
Part 2 Setting up a web server the easy way
LING 408/508: Computational Techniques for Linguists
Configuring Internet-related services
Part 2 Setting up a web server the easy way
LING 408/508: Computational Techniques for Linguists
PHP and Forms.
LING 408/508: Computational Techniques for Linguists
LING 408/508: Computational Techniques for Linguists
Presentation transcript:

LING 408/508: Programming for Linguists Lecture 17 October 28 th

Administrivia Did everyone get their webserver (OS X or Ubuntu or both) up and running?

Today's Topic Running a program on the webserver – cgi-bin Homework 8 Next time … – Sending form data to the webserver GET method POST method

Apache Webserver on OSX Webpage storage locations: cgi-bin directory: –/Library/WebServer/CGI-Executables/ usage: – permissions for *.cgi should be readable and executable – ls -l /Library/WebServer/CGI-Executables/ – -rwxr-xr-x 1 root wheel 161 Oct get.cgi – -rwxr-xr-x 1 root wheel 125 Oct post.cgi – -rw-r--r-- 1 root wheel 113 Oct 27 16:06 test.cgi – to change permissions sudo chmod 755 test.cgi html pages: /Library/WebServer/Documents/

Apache Webserver on OSX By default, Apple ships Apache2 with the cgi module turned off. Assuming the webserver is running, possible symptoms: prints program.cgi as plain text instead of executing it get.cgi doesn't exist!

Apache Webserver on OSX Enabling cgi-bin: 1.uncomment cgi_module line in file /etc/apache2/httpd.conf sudo nano /etc/apache2/httpd.conf 2.restart apache2

Apache Webserver on OSX Simple bash script, let's call it test : 1.#!/bin/bash 2.echo "Content-Type: text/plain" 3.echo 4.echo "Running Bash script from cgi-bin successfully!" 5.echo -n "Now: " 6.date 7.echo -n "User: " 8.whoami 9.exit 0 $pwd /Library/WebServer/CGI-Executables $ls -l test -rwxr-xr-x 1 root wheel 158 Oct 27 16:55 test $bash test Content-type: text/plain Running Bash script from cgi-bin successfully! Now: Tue Oct 27 16:58:24 MST 2015 User: sandiway $ Boilerplate browser expects: Content-Type: text/plain

Apache Webserver on OSX Compare: User: Preamble

Apache Webserver on Ubuntu CGI binaries directory: /usr/lib/cgi-bin/ – files must be made executable! create same test script executable permissions needed

Apache Webserver on Ubuntu Test:

Apache Webserver on Ubuntu Enabling cgi-bin: –sudo a2enmod cgi (enables cgid instead of cgi) –/etc/apache2/mods-enabled/ Before After

Apache Webserver on Ubuntu Compare running test directly: http//localhost/cgi-bin/test: User: www-data On OS X: _www

Apache Webserver on OSX To run programs in ~sandiway/Sites, i.e. outside of –/Library/WebServer/CGI-Executables modify the Apache httpd configuration file: –sudo nano /etc/apache2/httpd.conf uncomment invokes the cgi-script handler for all files of type.cgi

Apache Webserver on OSX Also modify /etc/apache2/users/sandiway.conf (created last lecture) to add the ExecCGI option as follows: 1. 2.AllowOverride All 3.Options Indexes Multiviews FollowSymLinks ExecCGI 4.Require all granted 5. #!/bin/bash echo "Content-Type: text/plain" echo echo "Running Bash script from ~/Sites successfully!" echo -n "Now: " date echo -n "User: " whoami exit 0 File ~sandiway/Sites/test.cgi

Apache Webserver on OSX

Apache Webserver on Ubuntu By default cgi-bin is not enabled for ~/public_html just displays program instead of running it

Apache Webserver on Ubuntu From – add these lines to /etc/apache2/apache.conf Options +ExecCGI AddHandler cgi-script.cgi – and restart apache2

Apache Webserver on Ubuntu /etc/apache2/apache2.conf I put the declarations here (I'm not sure it's the best place though…) I put the declarations here (I'm not sure it's the best place though…)

Apache Webserver on Ubuntu /etc/apache2/mods-available/userdir.conf

Apache Webserver on Ubuntu ~sandiway/public_html/test.cgi

Homework 8 Either on OS X or Ubuntu, enable cgi-bin to work from both the default location: – Ubuntu: /usr/lib/cgi-bin/ – OS X: /Library/WebServer/CGI-Executables – and from your user directory: – Ubuntu: ~yourusername /public_html/ – OS X: ~yourusername/Sites/ Write two different bash shell scripts, one for the default location and one for the user directory Show your system works (screenshots)

Homework 8 Make sure you get Homework 7 working before attempting Homework 8 Both are due Saturday night (by midnight)

Apache Webserver Reference documentation: – Warning message: – "Could not reliably determine the server’s fully qualified domain name" – Solution: define: ServerName localhost