Quick Tip: ImpressPages4 on Homestead

    Bruno Skvorc
    Share

    After a particularly painful encounter with another CMS, I figured it was time to try another. In this Quick Tip, we’ll install ImpressPages – a CMS that’s recently been revamped to version 4, and the tutorial of which is coming out soon on the PHP channel.

    Step 1: Homestead Improved

    As usual, get your Homestead Improved instance up and running. If you did vagrant up to see if it works, do vagrant destroy so we can configure it.

    Step 2: Sites and Folders

    Add a new site:

        - map: test.app
          to: /home/vagrant/Code/imp

    One thing to notice is that IP doesn’t use a (now) traditional approach to safe folder access on servers (pointing vhost root to /public and leaving everything else outside it) – everything (even its logic) is in the public web root. This is a highly insecure practice – be warned. What I’m saying is: ImpressPages is, by default, highly insecure on Nginx. I will be publishing another Quick Tip soon on how to secure ImpressPages on Nginx.

    Edit: The IP team have published instructions on securing the app on Nginx here.

    Boot the VM with vagrant up and enter it with vagrant ssh

    Step 3: Download ImpressPages

    cd Code
    wget http://sourceforge.net/projects/impresspages/files/latest/download -O imp.zip
    tar xvf imp.zip
    mv ImpressPages imp

    Step 4: Create the DB

    mysql -u homestead -psecret

    Once in mysql, execute:

    CREATE SCHEMA `imp` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
    exit

    Step 5: Run the Wizard

    In the host browser, visit the app’s URL, but add /install at the end. In my case, it’s test.app:8000/install.

    Follow instructions.

    [Optional] Step 6: Remove index.php from URL

    Use rewrite rules on Nginx to remove index.php from the URL:

    sudo vim /etc/nginx/sites-available/test.app

    The part between charset and “location” for favicon should be changed to this:

        rewrite ^/index\.php/(.*)$ /$1 permanent;
        location / {
            index index.php;
            try_files $uri $uri/ /index.php$args;
        }

    Since ImpressPages isn’t configured for Nginx, we need to tell it that “mod_rewrite” (which is an Apache module for URL rewriting) is actually enabled (even though it isn’t). In the file config.php in the root folder, remove the line that says mod_rewrite is disabled.

    Restart Nginx with sudo service nginx restart.

    That’s it!

    As you can see, ImpressPages is dead easy to set up. Even a non developer can easily install it onto a shared hosting server by simply unzipping – in this case, we went the extra mile and placed it onto Homestead for easier hacking and Linux testing.

    Hope this helped!

    CSS Master, 3rd Edition