Any tutorial to use my LEMP server to serve many WP sites?

April 2, 2015 908 views
Nginx LEMP WordPress DigitalOcean DigitalOcean Articles

So far I found a tutorial of how to install a simple WP installation on LEMP under Nginx, but actually what I want is to use the server to host my Html and my WP sites.

Does anyone knows any tutorial on how to configure the server ready to host many WP sites?

Thanks.

1 comment
  • Assuming that each WP site will have it's own set of files and web root directory you will just need to create a new configuration file in /etc/nginx/sites-enabled/ for each one making sure you set the server_name variable to it's domain or subdomain name and setting the root to the web root directory for that site. You should be able to simply copy the configuration file you set up in that directory while following the tutorial change those values and restart nginx with service nginx restart

2 Answers

I have my root web directory at /var/www/html/ and following the tutorial, I created a folder with the name Wordpress.

What I actually need is to have at the root directory, my main corporative website which is even in HTML so I just could upload the files and that is. But then, I need to have all my wp sites organized in a directory. I will call this directory secure/

What I would like to do, is configure 1 WP installation with the default plugins that I always use, like W3 supercache, Toast Seo, etc, and then, once I need a new WP installation, I think that I should do this:

  1. Copy the WP clean template directory installation, into the new one.
  2. Copy the WP database
  3. Open the wp-config,php and change the name of the database
  4. Copy the configuration file in /etc/nginx/sites-enabled/, change the server_name and setting web root directory.

Then, I'm not sure if the following commands are correct:

  1. To duplicate the directory wordpress I will cp -r wordpress newfoldername
  2. To copy the database, I don't know how to performance it.
  3. To edit the wp-config.php, I will move to the directory name cd directoryname and edit the file nano wp-config.php
  4. To copy the nginx configuration file I don't know how to do it, and to edit the new copied file I will do it typing sudo nano /etc/nginx/sites-available/newfile

Am I in the right way? Could someone let me know if the steps are correct and help how to copy/clone the database and copy the nginx configuration file?

Many thanks

Have another answer? Share your knowledge.