FAQs - 3 - Website

 

3.1 - How do I enable my website?
3.2 - What web server software do you run?
3.3 - Why can't I run cgi scripts?
3.4 - Can I use Java servlets?
3.5 - Do you support .htaccess files?
3.6 - How do I make a directory available from only inside tcd?
3.7 - I can't download certain files from outside tcd.
3.8 - Can I see web server logs anywhere?
3.9 - How can I debug my php scripts?
3.10 - Can I use gd with php?
3.11 - Why does my PHP script think all requests are coming from Matrix?
3.12 - Can I have xxx.netsoc.tcd.ie?
3.13 - What user do the php and cgi scripts run as?


3.1 - How do I enable my website?

Firstly, you must run the accept_waup.pl script to agree to the Matrix Web Acceptable Usage Policy. This makes you promise not to be naughty with your website. This should have your website enabled in no more than 24 hours. If this doesn't work, mail support@netsoc.tcd.ie.

After that, all you need to do is create a folder in your matrix userspace named www
Then put your web page files in there.
See also Setting up your Website and the service request form.

3.2 - What web server software do you run?

Apache/2.0.x (Unix) PHP/4.3.x
PHP setup [phpinfo() output]

3.3 - Can I run cgi scripts?

Sure. Create a cgi-bin directory in your webspace, and set approriate permissions on it with the following command: chmod 711 ~/www/cgi-bin. Put your cgi scripts in that directory, making sure their names end in .cgi, and you're in buisness.

3.4 - Can I use Java servlets?

No. We have discontinued this service.

3.5 - Do you support .htaccess files?

Yes, to a certain extent, specifically FileInfo, AuthConfig and Limit. See the apache documentation for details.

3.6 - How do I make a directory available from only inside tcd?

Create a file called .htaccess in the directory and place the following text in it:

Order Deny,Allow
Deny from all
Allow from 134.226
3.7 - I can't download certain files from outside tcd.

Aye. Certain files (MP3s, AVIs, etc) are only available from inside the TCD network. Trying to access these files from an external IP address will return a forbidden (403) message. This is a netsoc policy to reduce external network traffic so we don't get in trouble with ISS.

Also, there may be copyright issues with certain files. If you have your own MP3s on your site, you may request external access for them.

3.8 - Can I see web server logs anywhere?

We have Analog Server Stats (updated daily).

The raw logs are in /var/apache2/logs/ if you want to look yourself.

3.9 - How can I debug my php scripts?

There might be more useful messages in /var/apache2/logs/error_log and /var/apache2/logs/suphp_log

Eg. run tail -f /var/apache2/logs/error_log and run the script.

3.10 - Can I use gd with php?

Yes, GD is compiled into PHP.

3.11 - Why does my PHP script think all requests are coming from Matrix?

Requests for pages in users' directories are now forwarded from one Apache running on matrix to another. There are Reasons. An effect of this, though, is that $_SERVER['REMOTE_ADDR'], one of the values passed to PHP scripts, has matrix's IP address put in it; thus, scripts that use this value will think all requests are coming FROM matrix. This has implications if you're logging the IPs of those who post in your guestbook or forum, or trying to figure out what country people are coming from, or giving a different response to those accessing your site from Trinity and outside, for instance.

Fortunately, there's a solution. The original value of 'REMOTE_ADDR' gets saved, and ends up in $SERVER['HTTP_X_FORWARDED_FOR']. Simply substitute this value in any scripts you may already have that use 'REMOTE_ADDR', and bear it in mind if you're considering writing scripts that use this functionality. Note that 'REMOTE_HOST' (the hostname of the remote machine) is not forwarded. It's less generally useful, however if you do need it you can do a reverse lookup on the IP of the remote machine.

3.12 - Can I have xxx.netsoc.tcd.ie?

Subdomains are available to non-commercial student societies and organisations.

For example, we currently host TCDSU and USILGB.

3.13 - What user do the php and cgi scripts run as?

All php and cgi scripts run as yourself. We use suexec and suphp to achieve that. Naturally, this means that you can run a wide range of web applications. However, please be aware of security implicatons: a compromised web script has the powers to delete all your files. Do subscribe to mailing lists run by maintainers of software you install in your webspace. Do upgrade said software as soon as upgrades are available.