Edit History Actions Discussion

Diff for "Howto/Webpage/Wordpress"

Differences between revisions 14 and 15
Revision 14 as of 2008-04-24 23:26:10
Size: 5065
Editor: flipjarg
Comment: added info about proxy
Revision 15 as of 2008-06-04 16:07:51
Size: 5473
Editor: flipjarg
Comment: Cleaning up the page a little
Deletions are marked like this. Additions are marked like this.
Line 23: Line 23:
== Upgrading 2.4 -> 2.5 ==

See the blog entry here: http://independence.blinkenshell.org/blog/?p=26
Line 27: Line 31:
Edit WordPress' config file: Edit the WordPress config file:
Line 41: Line 45:
Surf to: `http://<username>.blinkenshell.org/blog/wp-admin/install.php` For WordPress 2.5 and up (at least to 2.5.1, the lastest version) you have to change WP_MEMORY_LIMIT to 16MB because this is what Blinkenshell's memory limit is at the moment.

The file containing WP_MEMORY_LIMIT is `wp-settings.php` and is located in the root directory of WordPress. So the directory WordPress is installed. The line you need to edit is `define('WP_MEMORY_LIMIT', '32M');`. Simply change it to `16M`. If you do not do this the WordPress installation will return a Fatal Error.

Next, surf to: `http://<username>.blinkenshell.org/blog/wp-admin/install.php`
Line 90: Line 98:
== Fixing the trailing slash problem ==
Line 109: Line 116:
== For Getting The Right IP Address == == Getting the right IP Address of Visitors ==
Line 111: Line 118:
Many stat plugins for WordPress list the country and IP address of the visitors to the blog. To show you which country the visitors are from you need the correct IP address. Plus it is just fun to see the different IP addresses also because you can tell if there were different users or the same people visiting. Many stat plugins for WordPress list the country and IP address of the visitors to the blog. To show you which country the visitors are from you need the correct IP address. Plus it is fun to see the different IP addresses because you can tell if there were different users or the same people visiting.
Line 113: Line 120:
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 forwarding 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.) Some plugins have an ''if statement'' to show the correct IP address but many leave this out. Currently you will only get the IP of the forwarding 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.) Some plugins have an ''if statement'' to show the correct IP address but many leave this out.
Line 115: Line 122:
Simply find the variable that sets the IP address, usually `$ip` or something similar. Change it from `$ip = $_SERVER['REMOTE_ADDR'];` to `$ipAddress = $_SERVER['HTTP_X_FORWARDED_FOR'];`

== Upgrading 2.4 -> 2.5 ==

See the blog entry here: http://independence.blinkenshell.org/blog/?p=26
Simply find the variable in your plugin that sets the IP address, usually `$ip` or something similar. Change it from `$ip = $_SERVER['REMOTE_ADDR'];` to `$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];`

How to install WordPress at Blinkenshell

Blinkenshell has a special kind of web server environment, requests for users' web pages are proxied through another web server on the way. This might cause some problems with software that doesn't take in to account that things like this happens, WordPress for example does not handle this properly, especially version 2.3 (WP Ticket #5089, WP Ticket #4602.)

Download and unpack

Download and unpack the latest version of WordPress (2.3 when writing this):

wget http://wordpress.org/latest.tar.gz

tar xvzf latest.tar.gz

Rename (and move):

mv wordpress public_html/blog

rm latest.tar.gz

Upgrading 2.4 -> 2.5

See the blog entry here: http://independence.blinkenshell.org/blog/?p=26

Set up MySQL

Set up a MySQL database in the signup program if you haven't already.

Edit the WordPress config file:

cd public_html/blog

mv wp-config-sample.php wp-config.php

nano -w wp-config.php

Enter login details for the database, remember that DB_HOST should be 192.168.0.1

Run installer

For WordPress 2.5 and up (at least to 2.5.1, the lastest version) you have to change WP_MEMORY_LIMIT to 16MB because this is what Blinkenshell's memory limit is at the moment.

The file containing WP_MEMORY_LIMIT is wp-settings.php and is located in the root directory of WordPress. So the directory WordPress is installed. The line you need to edit is define('WP_MEMORY_LIMIT', '32M');. Simply change it to 16M. If you do not do this the WordPress installation will return a Fatal Error.

Next, surf to: http://<username>.blinkenshell.org/blog/wp-admin/install.php

Enter blogs name and email, press next.

Copy the password and save it in a textfile or something.

When you press next again, the page will not load properly. Don't worry about it.

Fix URL

(Instructions with pictures available here: http://www.tamba2.org.uk/wordpress/site-url/ )

Go to https://marcusson.no-ip.com/phpmyadmin/

Log in to the database.

Browse the table wp_options.

Edit siteurl.

Replace 192.168.1.12:8000 something with the URL to your blog:

http://<username>.blinkenshell.org/blog/

Save.

Do the same with the option home, it's on the second page of options.

Logging in

Go back to your blog: http://<username>.blinkenshell.org/blog/

Login with "admin" and the password you saved in a textfile before.

Fixing URL redirects

Edit wp-includes/canonical.php

Insert this after the 4th row ("function redirect_canonical(...) {"):

$do_redirect = false;

This will set do_redirect always be false, whatever the caller tries to do.

This should take care of most problems, but not all.

Save the plugin found here to your WordPress plugin directory, like this:

cd ~/public_html/blog/wp-includes/plugins

wget http://flipjarg.blinkenshell.org/share/slashFix.txt

mv slashFix.txt slashFix.php

Open slashFix.php and change line 22 to use your Blinkenshell login name:

$user = "YOUR_USERNAME";

Now just go to your WordPress panel and activate the plugin.

Getting the right IP Address of Visitors

Many stat plugins for WordPress list the country and IP address of the visitors to the blog. To show you which country the visitors are from you need the correct IP address. Plus it is fun to see the different IP addresses because you can tell if there were different users or the same people visiting.

Currently you will only get the IP of the forwarding 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.) Some plugins have an if statement to show the correct IP address but many leave this out.

Simply find the variable in your plugin that sets the IP address, usually $ip or something similar. Change it from $ip = $_SERVER['REMOTE_ADDR']; to $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];

Known problems

When you edit certain settings etc, they will redirect you to a URL like: http://<username>.blinkenshell.org/~<username>/ or similar, just remove the second occurance of your username and press enter to load the real page. It might be possible to solve this with some htaccess magic.

When linking to your blog, using a trailing slash after the directory like: http://<username>.blinkenshell.org/blog/ seems to do the trick for getting your visitors to the correct URL. Without the trailing slash visitors may be redirected to an ugly URL with redundant <username>'s as mentioned above. The plugin that was menioned under the previous heading should fix this problem.

Using nice permanent links doesn't work out of the box, but shouldn't be impossible to get working properly with a bit of tweaking.

If you find solutions for any of these problems, please share them with us. This is wiki so you can just edit this page right away!

Good luck with your WordPress blog, and don't forget to join Planet_Blinkenshell! ;)


CategoryHowto CategoryWebapps