运行Centos7。我在从子目录中提供静态html文件时遇到问题。我已将所有权限设置为root,并已将用户设置为nginx.conf文件中的root用户。我已经包含了我的配置文件和我正在尝试从中提供html文件的目录的权限列表。我尝试提供的路径和文件是/ home / colin /
NGINX.CONF
user root;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
listen [::]:80 ipv6only=on default_server;
server_name _;
root /home/colin;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location /cap {
autoindex on;
try_files test.html /test.html;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
权限
f: /home/colin/test.html
drwxrwxrwx root root /
drwxr-xr-x root root home
drwxr-xr-x root root colin
-rwxr-xr-x root root test.html
我尝试了多种配置,使用不同的权限设置,使用别名和具有相同root权限的不同子目录 - 并出现同样的问题:403 Forbidden。我错过了一些明显的东西吗?任何帮助将不胜感激