@darknite
With NGINX + PHP-FPM, the same solution works as long as www-data
is the user configured to run your PHP-FPM instance.
The pool
files which set the user and group are located in:
/etc/php/7.0/fpm/pool.d
If you’re running a version other than 7.0 (5.6 or 7.1), simply change 7.0 to that version in the above.
Inside the ./pool.d
directory you’ll see a file called www.conf
which will contain the user and group that the specific pool is configured to run as. If you’ve not modified this file, it’s www-data
.
So what you need to do in order to setup your installation so that you don’t need to setup FTP/SFTP is chown
your files and directories to www-data
so that when a request is processed by PHP, it has the permissions needed to read/write.
So if your files are located in /var/www/html
, then running the command that Ryan provided is what you need to do.
If they are located elsewhere, then you need to change the path to that of where your files reside.
…
As a general note, the above path is for Ubuntu. It may differ on CentOS. The best way to find out would be to create a temporary file called info.php
and inside it, add:
<?php phpinfo();
Save and then access it via the web.
Find Configuration File (php.ini) Path
and that will be where you need to look. Once you find the path, delete that file as you no longer need it and don’t really want everything exposed publicly.
…
As far as learning how to manage a server, the guides here on DigitalOcean and Google are the best places to start. Check the dates and make sure they are recent.
Setup a small 512MB-1GB Droplet for testing as you learn – use it exclusively for learning so that you don’t potentially damage to your current live environment.
Most of the basics of Linux can be learned from the man
pages. So, for example, if you wanted to learn all about the cp
command (i.e. copy), you could run man cp
or even cp --help
. The same works for pretty much any command:
man cp
man mv
man rm
...
cp --help
mv --help
rm --help
Once you get familiar with the basics, you can move up from there.
When I’ve worked with individuals and guided/tutored them on basics and more advanced items (such as compiling NGINX from source, setting up Load Balancers and Proxies, etc), the basics are always what I recommend starting with.
Without the basics, it’s hard to do bash scripting (since you rely on the basics to write bash scripts) or even know what to do when it comes to doing more advanced setups.
…
Beyond reading the man
pages, and the guides here at DigitalOcean or available via Google, ask questions if you don’t know how to do something and want to learn.