You can make your own World Wide Web page(s) available on the Internet! Just complete these steps:
1. Go to the directory in your home directory called public_html. If this directory does not exist, you must create it first.
2. Create a file called index.html in this directory. This is your homepage file.
3. Type the information you want in to the file. This must be done in Hyper Text Markup Language (thus the extension html).
How to get started
- CHeck if link exists in your home dirrectory
ls -al ~/public_html
If you don't have an entry called "public_html" type the following to create it:
/apps/dcc/sbin/mk_public_html.sh
(As of October 2013 public_html is a link to /www/xx/x/public_html)
Now you have a directory where your web files will reside in. Start for example by making a file called index.html:
- Go to the public_html dirrectory
cd public_html
- Edit a new file called index.html (use your preferred editor)
vi index.html
- Write something like the following, very simple HTML5, and save it:
<!doctype html> <html lang="en">
<head>
<meta charset="utf-8"> <title>HTML5 Simple Template</title>
<meta name="description" content="HTML5">
<meta name="author" content="html5test"> <link rel="stylesheet" href="/css/styles.css?v=1.0">
</head> <body>
<p>HTML5 Example</p>
</body>
</html>
You should now have a web page up and running. Open in a web browser: http://www.student.dtu.dk/~username/
(where "username" should be replaced by _your_ username).
Permissions and access problems
To let others view your homepage, you have to set permissions on your public_html directory. For at better understanding of Unix Permissions read the section permissions
- First of all start a Terminal window.
- Then enter the following command, which will change the permissions on your public_html.
chmod 755 ~/public_html
- There is a more restrictive way. If you don't want to give everybody read/browse access to your web site.
chmod 701 ~/public_html
See the Permissions page for more information.
Password Protect
To password protect a page you need to create 2 files .htaccess and .htpasswd in the directory to protect. Sample contents are:
.htaccess
AuthType Basic
AuthUserFile PATH/.htpasswd
AuthName "Private area password required"
Require valid-user
Replace the above PATH with the location of your .htpasswd file. Normally this will be the public_html directory in your home. You can get this by running:
readlink ~/public_html
.htpasswd
This contains the usernames and password for the web page (don't use any existing passwords used for other systems). To create the password run:
htpasswd -c PATH/.htpasswd username
(omit the -c if you are adding a user to an existing file)
To prevent access from the filesystem level, you should also run chmod 701 on the sub-directory, see above permissions.
PHP and Server-Side scripting
We don't provide PHP or server-side scripting.
MySQL
We don't provide MySQL. The only MySQL server running at DTU is for courses which requires it.