Enterwell icon
Vedran Blazenka

WWDW Part I : Server Configuration

Your super cool WordPress web-site needs a place to live. In this blog post we’ll describe a process of setting up a new web server (we need SSH access, so if you have a shared hosting with FTP only, we cannot help you, sorry 🙁  ). This is our default test server configuration, if you have something better be sure to contact us.

Installing LAMPP stack

First you’ll need to install the LAMP stack (apache web server, MySQL database and PHP). You can find a great tutorial for this here.

After you finish this, please test it. This is a very important step. Please take special care of security aspects of this step. Always use the most secure options.

Adding modules

After installing LAMPP you’ll need to add these cool modules

Composer

Run theese commands from your terminal to install the latest version of the Composer

php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php
php -r "if (hash('SHA384', file_get_contents('composer-setup.php')) === '41e71d86b40f28e771d4bb662b997f79625196afcca95a5abf44391188c695c6c1456e16154c75a211d238cc3bc5cb47') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

This will check a few PHP settings and download a composer.phar to your working directory. To install the Composer globally you’ll need to add it to the PATH. You can do that with this command

 mv composer.phar /usr/local/bin/composer 

Git

Git is required by rocketeer, and you can install it with these simple commands

sudo apt-get update
sudo apt-get install git

mycrypt

sudo apt-get update
sudo apt-get install php5-mcrypt
sudo php5enmod mcrypt
sudo service apache2 restart 

mod_rewrite

WordPress require mod_rewrite to be enabled, if it’s not enabled already you should do it executing following commands

sudo a2enmod rewrite
sudo service apache2 restart

node.js and npm

sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm

Users and permissions

If you installed server, then you already have the all-mighty user. But, if you want to add other users, you just need to execute the following command.

sudo adduser {user-name}

After this command you’ll be prompted for a user password (choose a strong one) and other user-related info. If you want your user to be able to use sudo run the following command

sudo usermod -a -G sudo {user-name}

Now you’ll have to set up right permissions to /var/www folder. This folder should be owned by the root, but it should have www-data group (Apache group). To do that execute the following commands

sudo chown www-data /var/www
sudo chgrp www-data /var/www

But, every folder in it should be owned by www-data group. It is very wise to add your user (or users) to the www-data group. Run the following command to do that

sudo usermod -a -G www-data {user-name}

Now, it would be wise to set the correct permissions by running the following commands

sudo chmod -R 775 /var/www

Server name

Set a correct server name by editing file /etc/apache2/apache2.conf. You can do that by running:

sudo nano /etc/apache2/apache2.conf

Now, at the beginning of the file add this line and save the file.

ServerName {your-host}

What next ?

Now, you’ve set up your server. In order to deploy your WordPress site you’ll need to add a new site to the server, set up rocketeer and call rocketeer deploy task. Adding a new site to the server is described in this blog post:  WWDW Part II : Create A New Site

Info

This blog post is a part of Windows WordPress Development Workflow (WWDW) blog posts’ series. All blog posts in series are:

  1. WWDW Part I : Server Configuration
  2. WWDW Part II : Create A New Site
  3. WWDW Part III : Rocketeer
  4. WWDW Part IV : Enterwell’s way

 

Share on FacebookTweet about this on TwitterShare on LinkedInShare on RedditEmail this to someone