Edit History Actions Discussion

Diff for "Info/Webhosting"

Differences between revisions 12 and 13
Revision 12 as of 2009-07-07 21:15:54
Size: 3405
Editor: marco
Comment: one more capitalization
Revision 13 as of 2010-08-13 18:51:05
Size: 2401
Editor: independence
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
You can host your personal webpage or files at Blinkenshell.org. To do this, put any files you want to be accessible via HTTP in the directory public_html in your home directory. You can host your own personal webpage at Blinkenshell. To do this, put any files you want to be accessible via HTTP in the directory public_html in your home directory. The URL to your webpage will be `http://username.blinkenshell.org/`
Line 5: Line 5:
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 requesting a specific file (i.e. `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. If you have a file named `index.html` in your public_html directory that file will be used as the index page when someone browses to your site without requesting a specific file (i.e. `http://username.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.
Line 9: Line 9:
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 writable by "group" or "others". (''Group'' or ''Others'' doesn't even need read permissions, so `chmod 600` is fine for `.php` files. Static content will need read permission by ''Others'' however, `chmod 644` for example.) Logs from apache are written to `~/logs/access.log` (normal traffic) and `~/logs/error.log` (errors). These files are not writeable by your user and you can not delete or truncate them. This is because the logs are used for measuring traffic to your website.
Line 11: Line 11:
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 writable by "group" or "others". == CGI ==
Line 13: Line 13:
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.) CGI and PHP is only available on [[Info/Supporter]] accounts.
Line 15: Line 15:
== Proxy == You can use PHP and CGI scripts to create a dynamic webpage. CGI and PHP scripts are executed with mod_fcgi and suexec, which will make all scripts execute with your user id instead of the Apache user. To enable this feature contact Independence.
Line 17: Line 17:
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 don't take this into account. Also, suhosin is enabled to further increase security. For security reasons, all your `.php` files must ''not'' be writable by "group" or "others". (''Group'' or ''Others'' doesn't even need read permissions, so `chmod 600` is fine for `.php` files. Static content will need read permission by ''Others'' however, `chmod 644` for example.)
Line 19: Line 19:
A common failure is 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 forcing that to be used instead of trying to figure out the URL on its own.

Also, if you want to get the IP of a visitor you cannot use the normal way since you will only get the IP of the forwarding proxy. You should 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 may contain multiple IPs.)
PHP, Python, Perl and Ruby are installed. You can install your own frameworks such as Django or Ruby on Rails if you like, but they are not installed system-wide.
Line 25: Line 23:
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]].

Webhosting

You can host your own personal webpage at Blinkenshell. To do this, put any files you want to be accessible via HTTP in the directory public_html in your home directory. The URL to your webpage will be http://username.blinkenshell.org/

If you have a file named index.html in your public_html directory that file will be used as the index page when someone browses to your site without requesting a specific file (i.e. http://username.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.

Logs from apache are written to ~/logs/access.log (normal traffic) and ~/logs/error.log (errors). These files are not writeable by your user and you can not delete or truncate them. This is because the logs are used for measuring traffic to your website.

CGI

CGI and PHP is only available on Info/Supporter accounts.

You can use PHP and CGI scripts to create a dynamic webpage. CGI and PHP scripts are executed with mod_fcgi and suexec, which will make all scripts execute with your user id instead of the Apache user. To enable this feature contact Independence.

Also, suhosin is enabled to further increase security. For security reasons, all your .php files must not be writable by "group" or "others". (Group or Others doesn't even need read permissions, so chmod 600 is fine for .php files. Static content will need read permission by Others however, chmod 644 for example.)

PHP, Python, Perl and Ruby are installed. You can install your own frameworks such as Django or Ruby on Rails if you like, but they are not installed system-wide.

MySQL

For information on how to use MySQL, see: Info/MySQL.


CategoryInfo