What user rights should be used to configure the web environment in ubuntu?

win10 the virtual machine is installed with ubuntu16.04 LTS . After installation, I will log in to the system as an ordinary user dp, and then I need to install nginx and php , mysql and so on. What I have done now is
1, modify the permissions of nginx and php installation directory usr : sudo chmod ofigw / usr
2, modify nginx and php configuration file directory etc permissions: sudo chmod ostatw / etc
3, after compilation and installation, use:

my question:
1) do you need to install and run as root when installing and running these configuration environments?
2) is the nginx server installed, or do the php and web directories need to be run with different users?

Mar.12,2021

root user can be used to start the nginx service. The nginx configuration file specifies that the user specified by user is consistent with that specified by php-fpm


my answer is based on
1 in terms of ubuntu. For installing nginx, php and mysql, you need to switch to root (sudo su) for installation, because the configuration file under / etc/ requires root permission to be written. You can try to service nginx start, under ubuntu you need to perform the sudo operation or you will be required to provide password authentication. Using top to view the process, you will find that nginx accesses resources under the root website as user www-data.

has been set in the configuration file.

clipboard.png

clipboard.png

The directories of

2, nginx, php and mysql are all set up at the time of installation, which is generally ignored. However, the web directory is generally set to chown as a www-data user, for security reasons, and for nginx access to these resources, that is, www-data

the above are personal opinions, for reference only

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e48d6b-44ce5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e48d6b-44ce5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?