LING 408/508: Computational Techniques for Linguists

Slides:



Advertisements
Similar presentations
Adding Dynamic Content to your Web Site
Advertisements

1 Configuring Internet- related services (April 22, 2015) © Abdou Illia, Spring 2015.
Linux File & Folder permissions. File Permissions In Ubuntu, files and folders can be set up so that only specific users can view, modify, or run them.
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
SELinux (Security Enhanced Linux) By: Corey McClurg.
Apache Configuration Setting up a web server. Basic Server Facts Runs on port 80 Server application -> httpd Richly configurable Many defaults will let.
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.
Web Server Setup WEB SERVER SETUP.
Web Client/Server Communication A290/A590, Fall /09/2014.
APACHE SERVER By Innovationframes.com »
Setting up Greenstone for your organization Course material prepared by Greenstone Digital Library Project University of Waikato, New Zealand andNational.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
The Linux Operating System Lecture 5: Apache Tonga Institute of Higher Education.
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.
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.
1 Apache. 2 Module - Apache ♦ Overview This module focuses on configuring and customizing Apache web server. Apache is a commonly used Hypertext Transfer.
HTML Hyper Text Markup Language A simple introduction.
Scripting Languages Course 2 Diana Trandab ă ț Master in Computational Linguistics - 1 st year
Cosc 4750 Configuring httpd, Mysql, And Samba. defaults By default httpd demean will startup and work User directories are turned off Default directory.
Multi-Domain Hosting Hosting multiple domains on one server using Apache John Beckett 1/16/2013.
LING 408/508: Programming for Linguists Lecture 17 October 28 th.
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.
Form Processing Week Four. Form Processing Concepts The principal tool used to process Web forms stored on UNIX servers is a CGI (Common Gateway Interface)
More than one site? Use multiple configuration files Use multiple configuration files  httpd –d {path}  Assumes “conf/httpd.conf” Logging transactions.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
Lab 8 Overview Apache Web Server. SCRIPTS Linux Tricks.
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.
Tonga Institute of Higher Education IT 141: Information Systems
ITM352 PHP and Dynamic Web Pages: Server Side Processing 1.
Linux 101 Training Module Linux Basics.
Active Server Pages Computer Science 40S.
Unix System Administration
Lab 1 introduction, debrief
BIF703 File Permissions.
UNIX Basics Internet Technology.
Using Linux Commands Lab 3.
INSTALLING AND SETTING UP APACHE2 IN A LINUX ENVIRONMENT
FTP and UNIX TOPICS Exploring your Web Hosting Site FTP UNIX
LING 408/508: Computational Techniques for Linguists
LING 408/508: Computational Techniques for Linguists
Server Side Programming Overview And file system basics
Part 2 Setting up a web server the easy way
Permission and CHMOD.
Chapter 27 WWW and HTTP.
Tonga Institute of Higher Education IT 141: Information Systems
LING 408/508: Computational Techniques for Linguists
Web Programming Essentials:
Configuring Internet-related services
Part 2 Setting up a web server the easy way
LING 408/508: Computational Techniques for Linguists
PHP and Forms.
Tonga Institute of Higher Education IT 141: Information Systems
Enabling CGI & PHP With Apache
Intro to PHP.
LING 408/508: Computational Techniques for Linguists
CSE 303 Concepts and Tools for Software Development
SHELLSHOCK ATTACK.
Presentation transcript:

LING 408/508: Computational Techniques for Linguists Lecture 20

Today's Topic Did everyone get their webserver (OS X or Ubuntu or both) up and running? Apache2 Last time: we configured the root site http://localhost/ and a user site http://localhost/~yourusername/ Those are static webpages (but could contain Javascript which runs on the client): Today we will start running programs on the webserver itself.

Today's Topics Quick Homework 8: do before next time! Warning message: "Could not reliably determine the server’s fully qualified domain name" Solution: define in /etc/apache2.conf (or httpd.conf): ServerName localhost Quick Homework 8: do before next time!

Apache Webserver on OSX Storage locations: cgi-bin directory: /Library/WebServer/CGI-Executables/ usage: http://localhost/cgi-bin/test.cgi permissions for *.cgi should be readable and executable ls -l /Library/WebServer/CGI-Executables/ -rwxr-xr-x 1 root wheel 161 Oct 16 2014 get.cgi -rwxr-xr-x 1 root wheel 125 Oct 21 2014 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: uncomment cgi_module line in file /etc/apache2/httpd.conf sudo nano /etc/apache2/httpd.conf restart apache2

Apache Webserver on OSX Boilerplate browser expects: Content-Type: text/plain <blank line> Simple bash script, let's call it test: #!/bin/bash echo "Content-Type: text/plain" echo echo "Running Bash script from cgi-bin successfully!" echo -n "Now: " date echo -n "User: " whoami exit 0 755 rwx 100 = 4 010 = 2 001 = 1

Apache Webserver on OSX Boilerplate browser expects: Content-Type: text/plain <blank line> Simple bash script, let's call it test: #!/bin/bash echo "Content-Type: text/plain" echo echo "Running Bash script from cgi-bin successfully!" echo -n "Now: " date echo -n "User: " whoami exit 0 CGI-Executables$ ./test.cgi Content-Type: text/plain Running Bash script from cgi-bin successfully! Now: Tue Oct 30 11:10:12 MST 2018 User: sandiway make sure our bash script runs on the server…

Apache Webserver on OSX Compare: CGI-Executables$ ./test.cgi Content-Type: text/plain Running Bash script from cgi-bin successfully! Now: Tue Oct 30 11:10:12 MST 2018 User: sandiway http://localhost/cgi-bin/test.cgi User: Preamble: content-type and blank line

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

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

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

Running cgi-bin for users

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: <Directory "/Users/sandiway/Sites/"> AllowOverride All Options Indexes Multiviews FollowSymLinks ExecCGI Require all granted </Directory> #!/bin/bash echo "Content-Type: text/plain" echo echo "Running Bash script from ~sandiway/Sites successfully!" echo -n "Now: " date echo -n "User: " whoami echo -n "Directory: " ls -l exit 0 File ~/Sites/test.cgi

Apache Webserver on OSX http://localhost/~sandiway/test.cgi Dangerous! Why?

Apache Webserver on Ubuntu https://httpd.apache.org/docs/2.4/howto/cgi.html By default cgi-bin is not enabled for ~/public_html just displays program instead of running it

Apache Webserver on Ubuntu From https://httpd.apache.org/docs/current/howto/cgi.html add these lines to /etc/apache2/apache.conf <Directory "/home/*/public_html"> Options +ExecCGI AddHandler cgi-script .cgi </Directory> 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…)

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

Apache Webserver on Ubuntu

Documentation http://httpd.apache.org/docs/current/

Quick Homework 8 Make up two different bash shell scripts, one for the root server and one for the user. [Refresh your knowledge of bash scripting from the first few lectures.] Show them running using localhost/cgi-bin/example.cgi and localhost/~user/example.cgi Send me screen snapshots. Be adventurous!