使用php-fpm

时间:2017-08-13 02:39:19

标签: php nginx http-status-code-403

基本上我试图为nginx设置和别名。

目前我将localhost服务器设置为:/ usr / share / nginx / html,它运行正常。

我尝试将内部域名翻译:misemestrei.dom添加到/ home / frhec /文件夹,但我收到错误403.

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

Mi 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)

由于

1 个答案:

答案 0 :(得分:0)

我找到了一个解决方案,所有文件夹都必须具有可执行属性。

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

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