Writing HTML Scripts


  1. Check the HTML Help Pages.

  2. Apply for a UND Engineering Linux Account.

  3. Use VPN (Virtual Private Network) to connect to the UND networks.
  4. You may not need to do this if you are on campus.

  5. Log in to the Linux server undcemcs02.und.edu .

  6. Create a sub-directory “public_html” under the root directory.
  7. Create the directory by using the command mkdir:
       shell> mkdir ~/public_html 
    where the symbol ~ is the user’s root in the Linux file system.

  8. Execute the command chcon.
  9. If you are using CGI (Common Gateway Interface), execute the following command at the server undcemcs02. Otherwise, your CGI scripts will not work.
      shell> chcon -R -t httpd_sys_script_exec_t  /home/“USER.ID”/public_html 
    Swap out “USER.ID” with your login name:
      shell> chcon -R -t httpd_sys_script_exec_t /home/first.lastname/public_html 

  10. Create an HTML script.
  11. 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.

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

      shell>       
    Otherwise, open the HTML scripts to let the browser access them by using the command chmod:
      shell> chmod 755 ~/../user.id 
      shell> chmod 755 ~/public_html/ 
      shell> 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
    
      shell> chmod 755 ~user.id/public_html/test.html 
      shell> 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.

  14. View the HTML script on a browser.
  15. 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://undcemcs02.und.edu/~user.id/test.html
    Note that the directory name public_html is not in the address.


Review: Linux Shell Command chmod
Which option of the Linux shell command chmod allows the Web to read and write, but not execute a file?
      711
      715
      716
      717
        Result:






      “It is better to remain silent at the risk of being thought a fool,    
      than to talk and remove all doubt of it.”    
      ― Maurice Switzer, Mrs. Goose, Her Book