Ubuntu 16.04 WordPress LEMP Multiple Server Block Users Permissions

June 12, 2016 811 views
WordPress LEMP Nginx Security

Read this great new article on setting up a server on 16.04 with the ideal LEMP stack for WordPress.

It works great for a single site, but not for multiple sites. This other article helps resolve that issue: https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04

The issue is in that article is says to assign permissions to directory as user:user but that article even notes that won't work well in dynamic sites like WordPress.

Is there an article on how to deal with that so that on 16.04 when using having multple wordpress sites using the above articles, so that each will have permissions so that you can update WordPress and plugins via WordPress backend, and edit files via SFTP, and to make sure each site uses a different user for security?

Such perhaps site1usr:www-data for site1 and site2usr:www-data for site 2, and not sure if have to add users to www-data, or if each site should have a user for editing files, and a seperate user for just updating wordpress (as the secure WP article on DO is back from 2013).

Thank you!

1 Answer

Just to clarify, using site1usr:www-data for instance allows one to edit files via sftp but you can install/update wordpress via GUI. Using www-data:www-data allows wordpress gui to install update but you can't edit files via sftp.

I'm assuming the site directory should be set to either site1user:www-data or site1user:site1user and that site1user then needs to be added to the www-data group or such but hoping to find the best recommendations on that and the right commands. Thank you!

Have another answer? Share your knowledge.