PHP-FPM config
user = www-data
group = www-data
listen.owner = www-data
listen.group = www-data
Nginx config
user www-data;
And host config is
server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
root /home/SITENAME/www;
index index.php;
server_name SITENAME.com www.SITENAME.com;
include snippets/ssl-SITENAME.com.conf;
include snippets/ssl-params.conf;
access_log /home/SITENAME/logs/access.log combined;
error_log /home/SITENAME/logs/error.log warn;
location ~ /.well-known {
allow all;
}
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
expires 86400s;
add_header Pragma public;
add_header Cache-Control "max-age=86400, public, must-revalidate, proxy-revalidate";
location ~* ^.+\.(css|js)$ {
rewrite ^(.+)\.(\d+)\.(css|js)$ $1.$3 last;
expires 31536000s;
access_log off;
log_not_found off;
add_header Pragma public;
add_header Cache-Control "max-age=31536000, public";
}
location ~* \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|otf|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|t?gz|tif|tiff|ttf|wav|webm|wma|woff|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
expires 31536000s;
access_log off;
log_not_found off;
add_header Pragma public;
add_header Cache-Control "max-age=31536000, public";
}
}
User sitename is in a group www-data and user www-data is in a group user, but i still cant write in home directory, how to fix that? Chown user home dir to www-data is not solution, like is not solution using 777.
# id www-data
,# stat /home/SITENAME/www
.uid=33(www-data) gid=33(www-data) groups=33(www-data),1003(SITENAME)
stat /home/SITENAME/www File: '/home/SITENAME/www' Size: 4096 Blocks: 8 IO Block: 4096 directory Device: 9650b621h/2521871905d Inode: 131164 Links: 6 Access: (0755/drwxr-xr-x) Uid: ( 1003/ SITENAME) Gid: ( 1003/ SITENAME) Access: 2018-08-01 04:46:11.143075430 -0400 Modify: 2018-08-01 04:43:17.506400480 -0400 Change: 2018-08-01 04:43:17.506400480 -0400 Birth: -
SITENAME
user towww-data
group and useSITENAME
in PHP-FPM configuration? The current setup goes kinda backward.