Edit History Actions Discussion

Diff for "Info/Webhosting"

Differences between revisions 6 and 7
Revision 6 as of 2008-01-07 22:01:37
Size: 3175
Editor: client-81-105-71-188
Comment: sp
Revision 7 as of 2008-02-17 20:00:59
Size: 3191
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
You can use apache .htaccess-files to customize the behaviour of your webpage. [http://httpd.apache.org/docs/2.0/howto/htaccess.html Apache documentation on htaccess]. You can use apache .htaccess-files to customize the behaviour of your webpage. [[http://httpd.apache.org/docs/2.0/howto/htaccess.html|Apache documentation on htaccess]].
Line 21: Line 21:
Also, if you want to get the IP of a visitor you can not use the normal way since you will only get the IP of the forarding proxy. Instead use the data available in the `X-Forwarded-For` request header ([http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#x-headers More about X-headers in Apache's Documentation].) This data is available in the variable $_SERVER['HTTP_X_FORWARDED_FOR'] in PHP (this variable can contain multiple IPs.) Also, if you want to get the IP of a visitor you can not use the normal way since you will only get the IP of the forarding proxy. Instead use the data available in the `X-Forwarded-For` request header ([[http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#x-headers|More about X-headers in Apache's Documentation]].) This data is available in the variable $_SERVER['HTTP_X_FORWARDED_FOR'] in PHP (this variable can contain multiple IPs.)
Line 25: Line 25:
For information on how to use MySQL, see: ["Info/MySQL"]. Remember to connect to host `192.168.0.1` and not `localhost`. For information on how to use MySQL, see: [[Info/MySQL]]. Remember to connect to host `192.168.0.1` and not `localhost`.
Line 29: Line 29:
 * [http://httpd.apache.org/docs/2.2/ Apache Docs]
 *
[http://httpd.apache.org/docs/2.2/howto/htaccess.ht Apache Docs: htaccess]
 *
[http://httpd.apache.org/docs/2.2/suexec.html Apache Docs: suexec]
 * [http://php.net/
PHP Website]
 *
[http://www.hardened-php.net/suhosin/ Suhosin (Hardened PHP)]
 *
[http://www.dartmouth.edu/~rc/help/faq/permissions.html UNIX file permissions tutorial]
 * [[http://httpd.apache.org/docs/2.2/|Apache Docs]]
 * [
[http://httpd.apache.org/docs/2.2/howto/htaccess.ht|Apache Docs: htaccess]]
 * [
[http://httpd.apache.org/docs/2.2/suexec.html|Apache Docs: suexec]]
 * [[http://php.net/|
PHP Website]]
 * [
[http://www.hardened-php.net/suhosin/|Suhosin (Hardened PHP)]]
 * [
[http://www.dartmouth.edu/~rc/help/faq/permissions.html|UNIX file permissions tutorial]]

Webhosting

You can host your personal webpage or files at Blinkenshell.org. To do this, put any files you want accessable via HTTP in the directory public_html in your home directory.

If you have a file named index.html or index.php that file will be used as the index page when someone browses to your site without specifying a specific file (ie http://user.blinkenshell.org/ ) If you do not have an index file a directory listing of all the files in your public_html will be shown instead.

You can use apache .htaccess-files to customize the behaviour of your webpage. Apache documentation on htaccess.

You can use PHP for your webpage. PHP is configured with su_php which will make all scripts execute as your user permissions instead of the apache user. Also, suhosin is enabled to further increase security. For security reasons, all your php files must not be writeable by "group" or "others".

CGI is enabled in ~/public_html/cgi-bin and executed with suexec. Again, permissions are important here. The script has to be executable by your user, and it must not be writeable by "group" or "others".

The URL to your webpage is: http://username.blinkenshell.org/ (http://titan.blinkenshell.org/~username/ and http://blinkenshell.org/titan/~username/ also works. The last one is the most real, the others are done with mod_rewrite magic.)

Proxy

All requests to your webpage are handled by Apache on the shell server. However, the requests are proxied by a Reverse Proxy on the way. This might cause some problems, especially with PHP or CGI scripts that doesn't take this into account.

A common failiure is to not properly figuring out what URL to redirect after submitting a form. This is because there is no way for the script to know what URL the user should enter to access the script, since it's being rewritten by the proxying server. This is often solved by specifying a "base URL" or "absolute URL" or something similar in the script configuration file and force it use this instead of trying to figure out the URL on it's own.

Also, if you want to get the IP of a visitor you can not use the normal way since you will only get the IP of the forarding proxy. Instead use the data available in the X-Forwarded-For request header (More about X-headers in Apache's Documentation.) This data is available in the variable $_SERVER['HTTP_X_FORWARDED_FOR'] in PHP (this variable can contain multiple IPs.)

MySQL

For information on how to use MySQL, see: Info/MySQL. Remember to connect to host 192.168.0.1 and not localhost.


CategoryInfo