These instructions will guide you through how to set up a new website on your local machine using LocalWP while utilising Composer to manage plugins. This solution came about because managing plugins via git is a nightmare. WordPress doesn't have to be a massive pain, and while the setup process in these instructions is longer than just the default method, you'll thank yourself in the long run.
- Local WP -- Local WordPress development made simple.
- SpinupWP Composer Site -- WordPress site setup using Composer that is primed and ready to be hosted using SpinupWP.
- SpinupWP -- Modern Cloud-Based Server Control Panel.
- A theme of some sort. I recommend Sage 10 or Understrap if you're not ready to dive into Sage 10. Underscores is another good option if you don't want Bootstrap or Tailwind.
- This .gitignore file or your own version.
- Create a new site in LocalWP. I recommend Nginx, PHP 8.0+, and MySQL 8.0.16. SpinupWP has deprecated its support for MariaDB.
- Rename the
public
directory that was created by LocalWP. You can delete it but don't lose the wp-config! Rename it topublic_backup
or similar. - From the
app
folder, runcomposer create-project spinupwp/spinupwp-composer-site public
. This will download and set up WordPress in a more suitable structure for Composer. - Update the
.gitignore
file with the one mentioned above in the requirements. - Edit the
.env
file in the newpublic
directory and update the database settings with the wp-config.php from thepublic_backup
folder (the original directory that LocalWP created). - Update
WP_HOME
to be that of the local url you created. (Eg http://spinuptest.local ) - Open the
site.conf.hbs
file in thenginx
folder which is adjacent to theapp
folder that LocalWP created (NOT the app folder that composer create-project created). - Change the Line
root "{{root}}”;
to beroot "{{root}}/public";
. This tells LocalWP where the root DIR for the website is, since we've changed the structure by using the Spinup Composer Site repo. - Enable SSL for this site through LocalWP, then trust the new SSL in your keychain on Mac.
- Open the site shell, navigate to the public directory, and activate your theme.
wp theme activate theme-name
e.g.wp activate twentytwentyone
.
You can now do what you gotta do to make a sweet lookin' website!
When you are ready to go live, you can either use a plugin, or manually updload it to SpinupWP first. Once you've got the site up, don't forget to hook up your new git repo to your SpinupWP site.