【发布时间】:2016-05-20 11:13:35
【问题描述】:
我在笔记本电脑(运行 Arch Linux)上设置了 nginx、php、mysql 和 phpMyAdmin。一切都很好,直到我尝试在我的主目录中移动根目录。
这是我正在使用的 nginx 配置文件:
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$ {
if ($request_uri ~* /phpmyadmin) {
root /usr/share/nginx/html;
}
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;
}
}
所以我正在尝试制作这个“开发”文件夹——我将存储我的所有 php 项目的文件夹。而且我想将 phpMyAdmin 保留在其默认位置。 现在,如果我尝试访问 phpMyAdmin 或新位置上的任何 php 文件,我会得到 403 Forbidden - 错误消息:
2016/05/20 14:11:46 [crit] 5292#5292: *3 stat() "/home/me/Development/test.php" failed (13: Permission denied), client: 127.0.0.1, server: localhost, request: "GET /test.php HTTP/1.1", host: "localhost"
它应该对 linux 组和权限做一些事情,但无法弄清楚。
【问题讨论】:
标签: nginx