How to Install WordPress When Using Vagrant Folder Sync

This step assumes you have already followed these steps:

  1. Vagrant, VirtualBox, Ubuntu 16.04 Setup
  2. Install LAMP Stack on Ubuntu

Below are the final steps (with slight modifications) in How To Install WordPress On Ubuntu 14.04 which allow for php mod rewrite:

move into the directory:

cd /var/www/html/site

change ownership properties, where user below is the user (e.g. root):

sudo chown -R user:www-data *
sudo chown -R :www-data /var/www/html/site/wp-content/uploads

To modify apache to allow URL rewrites:

sudo nano /etc/apache2/sites-available/000-default.conf

here we set the ServerName (e.g. localhost) and create a directory section where we allow overrides:

<VirtualHost *:80>
      ServerAdmin webmaster@localhost
      DocumentRoot /var/www/html
      ServerName server_domain_name_or_IP
      <Directory /var/www/html/>
             AllowOverride All
      </Directory>
. . .
sudo a2enmod rewrite
sudo service apache2 restart

if there is not one already, create an .htaccess file:

touch /var/www/html/home/.htaccess
sudo chown :www-data /var/www/html/home/.htaccess
chmod 664 /var/www/html/home/.htaccess

Now in wordpress settings, we can got to ‘Settngs' > ‘Permalinks' and choose settings as necessary

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.