I want my nginx to server files from my user home directory, but I keep getting error 403 forbidden.
nginx.conf
user http;
worker_processes 2;
error_log logs/error.log;
error_log logs/error.log notice;
error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#server_name_in_redirect off;
root /home/txx/http/www;
location / {
index index.php index.html index.htm;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php56-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
I have directory /home/user/http/www and all subfolders set to 775 with, and all belongs to http group.
drwxrwxr-x 10 txx http 4096 20.04.2017 19:28 www/
I've run 'chmod 755 -R www/*' 'chmod 775 -R www'
What could be this about?
setenforce 0
or make sure that the proper context is set on the directory and the correct selinux booleanhttpd_read_user_content_t
andhttpd_enable_homedirs
Also see this post