Showing posts with label LAMP. Show all posts
Showing posts with label LAMP. Show all posts

7 November 2016

Wordpress on Ubuntu user edition

(Updated for Ubuntu 13.10)

Install LAMP

  1. sudo apt-get install tasksel
  2. sudo tasksel install lamp-server
  3. You may also want to install phpmyadmin, and I needed php-curl too
  4. Edit apache.conf to get rid of startup message, i.e.
    • Add ServerName localhost to apache.conf
(Along the way you'll need to add a root password for MySQL, and check that /etc/hosts has a good entry for your IP address so that Apache will run.)

Enable user directories in Apache

I set up my beta website in a home directory as it avoid lots of permissions issues. To turn on user directories:
  1. sudo a2enmod userdir
  2. Enable php in user directories: edit /etc/apache2/mods-enabled/php5.conf
  3. enable rewrite commands in .htaccess for nice permalinks: sudo a2enmod rewrite
  4. sudo service apache2 restart

Using a non-standard port

My ISP does not allow servers on port 80 but does permit them on other ports. Based on these instructions I

edit /etc/apache2/ports.conf to read:

Listen 80 
Listen 6111

create a new file in /etc/apache2/sites-available with the following content
<VirtualHost *:6111>
ServerAdmin webmaster@localhost
DocumentRoot /home/[name]/public_html
<Directory /home/[name]/public_html>
Options Indexes FollowSymLinks MultiViews
        AllowOverride All
         Order allow,deny
         allow from all
 Require all granted
</Directory>
</VirtualHost>
Listen 6111
  • And link this file to the sites-enabled directory
    • sudo ln -n sites-available/61112.conf sites-enabled/
(Tweak firewall if necessary, and recreate mysql user names with 'localhost' privileges.)

Additional steps


  1. Configure MySQL: (Re-)Create the database user, import the MySQL backup, and reattach privileges.
  2. Install Ruby via Software Centre
  3. Install compass (which installs Sass)
  4. Install sublime sass highlighting package controller

18 September 2013

Wordpress custom rss feed


I needed to create a custom rss feed so that some of my wordpress data could be syndicated.


  1. Make a copy of wp-includes/feed-rss2 into a /feeds directory for your theme
  2. Edit the file name to replace rss2 in filename and edit the xml as necessary
  3. Copy the following into functions.php

function do_feed_($for_comments) {
load_template(STYLESHEETPATH . '/feeds/feed-.php');
}
add_action('do_feed_', 'do_feed_', 10, 1);

and then load using http://yourblog.com/?feeds=

Behind the scenes wordpress takes the feeds parameter and looks for the function do_feed_, which you have now set to turn to your feed template

Easy!