Nginx 403 错误 php 使用 php-fpm

Nginx 403 error with php using php-fpm

基本上我正在尝试为 nginx 设置和别名。

目前我的本地主机服务器设置为:/usr/share/nginx/html 并且工作正常。

我尝试添加一个内部域翻译:misemestrei.dom 到 /home/frhec/folder 但我收到错误 403。

我已经尝试将用户所有权更改为 'http' 并将用户权限设置为 755,但我仍然遇到相同的错误。

米nginx.conf是:

user http;
worker_processes  auto;
worker_cpu_affinity auto;
pcre_jit on;

error_log  logs/error.log;
error_log  logs/error.log  notice;
error_log  logs/error.log  info;

events {
    worker_connections  2048;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    tcp_nopush     on;
    aio threads;
    server_tokens off;
    charset utf-8; 
    keepalive_timeout  65;

    #Omited localhost server configuration, it's similar#        

    server {
       listen       80;
       server_name  misemestrei.dom;
       client_max_body_size 25M;

       location / {
            root   /home/frhec/folder;
            index  index.php index.html index.htm;
       }

       error_page   500 502 503 504  /50x.html;
       location = /50x.html {
          root   /home/frhec/folder;
       }

       location ~ \.(php|html|htm)$ {
         fastcgi_pass   unix:/run/php-fpm/php-fpm.sock;
         root           /home/frhec/folder;
         fastcgi_index  index.php;
         include        fastcgi.conf;
       }

       include sites-enabled/*;

    }
}

我的 /etc/hosts 看起来像:

#
# /etc/hosts: static lookup table for host names
#

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1       localhost.localdomain   localhost
127.0.0.1       misemestrei.dom         misemestrei.dom
::1             localhost.localdomain   localhost


# End of file

文件夹如下所示:

drwxr-xr-x 4 http  http  4096 Aug 12 21:02 .
drwxr-xr-x 4 http  http  4096 Aug 11 15:56 ..
-rwxr-xr-x 1 frhec users   61 Aug 11 15:15 composer.json
-rwxr-xr-x 1 frhec users 2492 Aug 11 15:15 composer.lock
drwxr-xr-x 2 frhec users 4096 Aug 12 21:07 .idea
-rwxr-xr-x 1 http  http    0 Aug 12 21:02 index.php
-rwxr-xr-x 1 http http  367 Aug 11 15:21 mongodb01.php
drwxr-xr-x 4 frhec users 4096 Aug 11 15:15 vendor

我正在使用 Antergos (Arch-Linux)

谢谢

我找到了解决办法,所有文件夹必须有可执行文件属性。

所以我把它应用到整条路线

sudo chmod +x /home
sudo chmod +x /home/frhec
sudo chmod +x /home/frhec/folder