Configuring WordPress services revision 1

Introduction

This page describes how Alexis Huxley installed and configured WordPress.

Procedure

  1. Run:
    apt-get install wordpress mysql-server libssh2-php
  2. Apache2:
    Alias /wordpress/wp-content /var/lib/wordpress/wp-content
    Alias /wordpress /usr/share/wordpress
    <Directory /usr/share/wordpress>
        Options FollowSymLinks
        AllowOverride Limit Options FileInfo
        DirectoryIndex index.php
        Order allow,deny
        Allow from all
    </Directory>
    <Directory /var/lib/wordpress/wp-content>
        Options FollowSymLinks
        Order allow,deny
        Allow from all
    </Directory>
  3. Mysql:
    vermicelli# mysql
    mysql> create database wordpress;
    Query OK, 1 row affected (0.00 sec)
    
    mysql> grant all privileges on wordpress.* to "wordpress"@"localhost" \
        identified by "SUPERSECRETPASSWORD";
    Query OK, 0 rows affected (0.01 sec)
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> <CTRL-D>
    vermicelli#
  4. Test:
    vermicelli# w3m -dump http://localhost/blog/
    Neither /etc/wordpress/config-localhost.php nor /etc/wordpress/
    config-localhost.php could be found.
    Ensure one of them exists, is readable by the webserver and contains the right
    password/username.
    vermicelli#
  5. Proxy:
        ProxyPass /wordpress/ http://192.168.1.11/wordpress/
        ProxyPassReverse /wordpress/ http://192.168.1.11/wordpress/
  6. WP config:
    vermicelli# cat /etc/wordpress/config-no-ip.org.php
    <?php
    define('DB_NAME', 'wordpress');
    define('DB_USER', 'wordpress');
    define('DB_PASSWORD', 'SUPERSECRETPASSWORD');
    define('DB_HOST', 'localhost');
    define('SECRET_KEY', 'PNDEmese10MsJEv9BYA2umcp8QRiylcQy9uRo0DnlF');
    define('WP_CONTENT_DIR', '/var/lib/wordpress/wp-content');
    ?>
    vermicelli#
  7. Allow theme installation:
    chown -R www-data:www-data /var/lib/wordpress/wp-content
  8. To make permalinks (nicely named links) work:
    chown www-data:www-data /usr/share/wordpress/.htaccess
    a2enmod rewrite
    service apache2 restart
  9. Go to https://www.pasta.freemyip.com/ it should look like this:
    wordpress-installation-screenshot-01
  10. Theme tuning:
    vi /var/lib/wordpress/wp-content/themes/reddle/footer.php
  11. To get rid of horizontal scrollbars in preformatted blocks, which are inserted by Reddle, go to Dashboard –> Appearance –> Editor and locate the CSS code:
    overflow-x: scroll;

    and change this to:

    overflow-x: auto;
  12. Install the following plugins:
    • Akismet
    • Cleaner Gallery
    • Easy Content Templates
    • Easy FancyBox
    • Jetpack Lite
    • Manage Upload Types
    • MapPress Easy Google Maps
    • Media File Manager
    • Quick Cache
    • Simplified Google Maps Light
    • TablePress
    • WordPress Importer
    • WP SlimStat
    • YouTube
  13. The Quick Cache plugin is enabled by running the following command:
    perl -pi -e "s/(<\?php)/\$1 define('WP_CACHE', true);/" /usr/share/wordpress/wp-config.php
  14. The ‘MapPress Easy Google Maps’ plugin puts, what appears to be, a gray top border around maps. More likely, this is a border around an item that I do not display. To get rid of this, edit /var/lib/wordpress/wp-content/plugins/mappress-google-maps-for-wordpress/css/mappress.css and change this:
    /* Links for the map */
    .mapp-map-links {
            background-color: #F0F0F0;
            border-top: 1px solid lightgray;
            border-bottom: 1px solid lightgray;
    }

    to this:

    /* Links for the map */
    .mapp-map-links {
            background-color: #F0F0F0;
            /*
             *  Next lines commented out by Alexis, to remove top gray
             *  border from above maps. Note that *both* the border-top
             *  and border-bottom need to be removed; presumably, it is
             * not the *map* that has a border, but rather some other
             * item that is empty.
             */
    
            /* border-top: 1px solid lightgray
            border-bottom: 1px solid lightgray; */
    }
  15. Enable RPAF (so that the stats modules use the real clients’ IP addresses and not the proxy’s) as follows:
    1. Run:
      apt-get install libapache2-mod-rpaf
    2. Add the following to the apache configuration:
      RPAFenable On
      RPAFsethostname On
      RPAFproxy_ips <ip-of-first-proxy> ...
    3. Run:
      service apache2 restart
  16. When uploading GPX files to my Cycling pages, I hit the maximum upload limit for a file, which was 2MB; this is not a WordPress issue, but rather issue with the underlying PHP. To fix it run:
    find /etc/php* -type f -exec grep -ril upload_max_filesize {} \; | xargs sed -i 's/\(upload_max_filesize\) = .*/\1 = 20M/'
    find /etc/php* -type f -exec grep -ril post_max_size       {} \; | xargs sed -i 's/\(post_max_size\) = .*/\1 = 19M/'
    service apache2 restart

    (Note how the thresholds are raised to different values; this will make it easier to determine which threshold is reached, if any.)

See also