Nginx не сервер подкаталога api-приложения (php-fpm)

У меня есть следующая структура папок для моего приложения, расположенная на карте /home/valor/development/mypp.com/public_html/

- css
- app
- js
- ...
- server (codeigniter)
  -- system
  -- application
  -- index.php
- index.html (angularJS app)

это мой nginx.conf

server {
        listen 80;
        listen [::]:80;

        root /home/valor/development/euro-swap.com/public_html;

        index index.html;

        server_name euro-swap.com www.euro-swap.com;

        location / {
              index  index.html;
        }

        location /server/ {
                index /server/index.php;
                try_files $uri /server/index.php/$uri;
        }

        location /twitter/ {
                index /twitter/index.php;
                try_files $uri /twitter/index.php/$uri;
        }

        location ~ \.php {
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                include fastcgi_params;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        }

        #deny access to .htaccess files, if Apache's document root
        #concurs with nginx's one
        location ~ /\.ht {
               deny all;
        }
}

И это ошибка, которую я все время получаю

2016/03/04 18:26:02 [error] 4577#0: *4 FastCGI sent in stderr: "Unable to open primary script: /home/valor/development/myapp.com/public_html/server/index.php (No such file or directory)" while reading response header from upstream, client: 127.0.0.1, server: myapp.com, request: "GET /server/api/users/isLoggedIn HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "myapp.com", referrer: "http://myapp.com/"
2016/03/04 18:26:02 [error] 4577#0: *3 FastCGI sent in stderr: "Unable to open primary script: /home/valor/development/myapp.com/public_html/server/index.php (No such file or directory)" while reading response header from upstream, client: 127.0.0.1, server: myapp.com, request: "GET /server/api/categories HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "myapp.com", referrer: "http://myapp.com/"
2016/03/04 18:26:03 [error] 4577#0: *3 FastCGI sent in stderr: "Unable to open primary script: /home/valor/development/myapp.com/public_html/server/index.php (No such file or directory)" while reading response header from upstream, client: 127.0.0.1, server: myapp.com, request: "GET /server/api/products/latest/16 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "myapp.com", referrer: "http://myapp.com/"

Страница отображается правильно, я просто могу получить доступ к ресурсам api в подпапке. Можешь ли ты помочь мне, парень, что я делаю неправильно? Если вам нужна дополнительная информация, дайте мне знать, и я предоставлю

Спасибо

0
задан 4 March 2016 в 19:40
1 ответ

Это может быть проблемой разрешения, возможно, вызванной AppArmor. Просмотрите этот ответ , чтобы увидеть возможное решение. Я не хочу красть ответ, поэтому связываюсь с ним.

РЕДАКТИРОВАТЬ: теперь проблема может возникнуть из конфигурации php-fpm. Откройте /etc/php5/fpm/pool.d/www.conf с помощью вашего любимого редактора и раскомментируйте следующие строки:

listen.owner = www-data
listen.group = www-data
listen.mode = 0660

и не забудьте перезапустить php-сервер с помощью:

service php5-fpm restart
1
ответ дан 4 December 2019 в 16:40

Теги

Похожие вопросы