Frequently Asked Questions - Web Related



Prerequisites for hosting web content on your cse account.

School of Computing (SoC) users can host web content such as HTML or PHP pages on the cse.unl.edu server. There are a few prerequisites such as required directories and permissions on these directories. This section will go over these.

Before we get started, a word on directory permissions. We'll need to grant others execute permissions on certain directories. Granting execute permission on a directory, allows others to access (traverse/come into) your directory, in this case the web server will need to access the HTML files you wish to publish. Note: This is not the same as granting read access on a directory. Read access allows someone to list the content of the directory. When execute but not read access is granted, the user can only access files they know the full path to, and in addition, they must have read access to the particular file in question.

  1. You will need to open a Unix command line session to cse.unl.edu. Since the steps are different for Windows and Mac users, this topic is covered in the respective FAQ sections.
  2. Make sure your home directory has execute permission for everyone(others). Note: the "~" symbol is a shortcut to "My Homedirectory". Enter "chmod o+x ~" in the command prompt as shown below.
     > chmod o+x ~ 
  3. Create a public_html directory in your home directory by issuing the command below. The public_html directory is the root of your Web documents. A world readable file placed in this directory will be accessible on the web by using the URL http://cse.unl.edu/~login_id/file where you would replace ~login_id with "~"+ your login id.
     > mkdir ~/public_html
  4. The public_html directory must also have execute permission for everyone(others). Enter the command shown below.
     > chmod o+x ~/public_html 
  5. You can now setup a index.html page (the default page serviced by the web server) to test your web site.

Back to top ↑



How to setup your first PHP page on cse.unl.edu

  1. Make sure you have read and setup the required directories and permission as described in FAQ section on Prerequisites for hosting a web page on cse.unl.edu.
  2. Change your working directory to the public_html directory.
     > cd ~/public_html
  3. Open a command line session to cse.unl.edu.
  4. Use an editor like vi or pico to create the index.php file. Refer to the FAQ pages on editors on cse.unl.edu. Pico being the simple Unix editor to use.
     > pico index.php 
  5. Use the editor to insert some HTML into the file, a simple HTML content is shown below.
        <html>
           <head>
               <title> This is my first page </title>
           </head>
           <body>
              <h1> My first page</h1>
              <?php  echo "<p>Hello World </p>" ?>
           </body>
        </html>
    
  6. Save the file and return to the command line.
  7. Grant everyone (others) read access to the file you just created.
     > chmod o+r index.html
  8. Open a browser and point it to: http://cse.unl.edu/~login/index.php and you should see the file you just created.
  9. If you get an error, tail the /var/log/apache2/error_log (the tail command shows any new lines added to a file) while you try to access your page to see if there are any errors. If you don't see errors in error_log, you should tail /var/log/apache2/suphp.log as well and then try to access your page again to see if any errors are reported.
     > tail -f /var/log/apache2/error_log 
  10. If you still can't get your PHP program working, see if the student resource center can be of any assistance or send an email to support@cse.unl.edu and someone will help you identify the problem.

Back to top ↑



Common problem with setting up home pages

  • Your home directory and public_html directory must have world execute permissions.
  • Your html documents must be given world read access
  • Any images enclosed should have a path relative to your public_html directory. The image load will fail if you specify a full path to the image
  • To point to another file in your public_html directory, use a hypertext link of the following form
  • Tail the /var/log/apache2/error_log (The tail command shows any new lines added to a file) while you try to access your page to see if there are any errors.
     > tail -f /var/log/apache2/error_log 

Back to top ↑



Setting up a basic web page on cse.unl.edu

  1. Make sure you have read and setup the required directories and permission as described in FAQ section on Prerequisites for hosting a web page on cse.unl.edu
  2. Change your working directory to the public_html directory
     > cd ~/public_html
  3. Open a command line session to cse.unl.edu
  4. Use an editor like vi or pico to create the index.html file - refer to the FAQ pages on editors on cse.unl.edu. Pico being the simple unix editor to use.
     > pico index.html 
  5. Use the editor to insert some HTML into the file, a simple html content is shown below.
        <html>
           <head>
               <title> This is my first page </title>
           </head>
           <body>
              <h1> My first page</h1>
              <p> Hello World </p>
           </body>
        </html>
           
  6. Save the file and return to the command line
  7. Grant everyone(others) read access to the file you just created
     > chmod o+r index.html
  8. Open a browser and point it to: http://cse.unl.edu/~login/index.html and you should see the file you just created.

Back to top ↑