I have set a nginx, php-fpm, mysql and phpMyAdmin on my laptop (running Arch Linux). Everything was ok till I tried to move the root in my home directory.
Here is the nginx configuration file I'm using:
#user html;
#user root root;
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;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
server {
############### General Settings ###################
listen 80;
server_name localhost;
root /home/me/Development;
charset utf-8;
############## Document Root #####################
location / {
index index.php index.html index.htm;
autoindex on;
}
############## PHPMyAdmin #######################
location /phpmyadmin {
rewrite ^/* /phpMyAdmin last;
}
############# Error redirection pages ################
error_page 404 NGINX/html/404.html;
error_page 500 502 503 504 NGINX/html/50x.html;
############## Proxy Settings for FastCGI PHP Server #####
location ~ \.php$ {
try_files $uri =404;
#fastcgi_pass 127.0.0.1:9000; (depending on your php-fpm socket configuration)
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi.conf;
}
location ~ /\.ht {
deny all;
}
}
}
When i try to reach a php file (localhost/phpMyAdmin) I get the following error:
2016/05/20 16:33:12 [error] 8145#8145: *2 "/home/me/Development/phpMyAdmin/index.php" is forbidden (13: Permission denied), client: 127.0.0.1, server: localhost, request: "GET /phpMyAdmin/ HTTP/1.1", host: "localhost"
I've tried to change the rights(777 -not really a good idea) and the owner (username:username) of "Development" folder but with no success.
also I have added in the nginx.conf file the following line:
user root root;
But this caused an error with the connecting of the php-fpm. I also has this line of code in my php.ini to make sure the the new directory is allowed path for php.
open_basedir= /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/:/usr/:/home/me/Development/
Any ideas what I'm doing wrong?