Writing HTML Scripts


  1. Check the HTML Help Pages.

  2. Apply for a UND Engineering Linux Account.

  3. Log in to the Linux Server: undcemcs03.und.edu .

  4. Create a Sub-Directory “public_html” under the Root Directory.
  5. Create the directory by using the command mkdir:
       undcemcs02> mkdir ~/public_html 
    where the symbol ~ is the user’s root in the Linux file system.

  6. Execute the Command chcon .
  7. If you are using CGI (Common Gateway Interface), execute the following command at the server undcemcs02. Otherwise, your CGI scripts will not work.
      undcemcs02> chcon -R -t httpd_user_content_t \ 
                  /home/”USER.ID”/public_html 
    Swap out “USER.ID” with your login name:
      undcemcs02> chcon -R -t httpd_user_content_t \ 
                  /home/first.lastname/public_html 
    (or replace the above two commands by the following two commands:
      undcemcs02> chcon -R -t httpd_user_content_t /home/”USER.ID”/public_html 
      undcemcs02> chcon -R -t httpd_user_content_t /home/first.lastname/public_html 
    where the backslash symbol ‘\’ is used to continue the current command to the next line.)

  8. Create an HTML Script.
  9. Create/edit an HTML script in the public_html directory. An example script is ~/public_html/test.html. Check the HTML Tutorial for how to write HTML scripts.

  10. Open the HTML Script.
  11. This step is NOT needed if the default permission of files is open or the web server is the script’s owner:

      undcemcs01>       
    Otherwise, open the HTML scripts to let the browser access them by using the command chmod :
      undcemcs02> chmod 755 ~/../user.id 
      undcemcs02> chmod 755 ~/public_html/ 
      undcemcs02> ls -all ~user.id/public_html/ 
        total 104
        drwxr-xr-x  2 userid cslinux 4096 Jan  5  2017 ./
        drwxr-xr-x 67 userid cslinux 4096 Mar 13  2016 ../
        -rw-r--r--  1 userid cslinux 4854 Nov 20  2014 a.out
        -rw-r--r--  1 userid cslinux 5977 Jan  5  2017 index.html
        -rwx------  1 userid cslinux  227 Nov 20  2016 test.html
    
      undcemcs02> chmod 755 ~user.id/public_html/test.html 
      undcemcs02> ls -all ~user.id/public_html/ 
        total 104
        drwxr-xr-x  2 userid cslinux 4096 Jan  5  2017 ./
        drwxr-xr-x 67 userid cslinux 4096 Mar 13  2016 ../
        -rw-r--r--  1 userid cslinux 4854 Nov 20  2014 a.out
        -rw-r--r--  1 userid cslinux 5977 Jan  5  2017 index.html
        -rwxr-xr-x  1 userid cslinux  227 Nov 20  2016 test.html
    where user.id is your Linux account identifier.

    Note that the above commands may not be complete. You have to open all the files and folders in the public_html directory.

  12. View the HTML Script on a Browser.
  13. You can then check the HTML script on the browser. For the example of the HTML script ~/public_html/test.html, the page is at the location or URL:
      http://undcemcs03.und.edu/~user.id/test.html
    Note that the directory name public_html is not in the address.


Review: Linux/Unix Shell Command chmod
    Which option of the Unix shell command chmod allows the Web to read and write, but not execute a file?

      711
      715
      716
      717
        Result:





      The fool doth think he is wise, but the wise man knows himself to be a fool.    
      ― William Shakespeare, As You Like It