Я настроил NGINX для выполнения моего приложения laravel внутри моего каталога FTP. Однако, когда я захожу на свой веб-сайт, я получаю 502 плохих шлюза.
Моя конфигурация выглядит следующим образом:
server {
server_name exoscape.co.uk;
root /home/exoscapeftp/ftp/ExoscapeWebsite/public;
# Disallow access to hidden files (.htaccess, .git, etc.)
location ~ /\. {
deny all;
}
# Some locations will never contain PHP files, handle it in the server
location ~ ^/(robots.txt|favicon.ico)(/|$) {
try_files $uri =404;
}
location = /index.php {
# Disable direct access to the source code of index.php. If you have a
# Laravel route for '/index.php', copy the @php_router block below.
return 404;
}
location / {
# Try to serve the static files, otherwise call into PHP
try_files $uri @php_router;
}
location @php_router {
include fastcgi_params;
# If you move index.php outside public/, adjust it here.
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_pass unix:/var/run/php7.0-fpm.sock;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/exoscape.co.uk/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/exoscape.co.uk/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
}
Я гарантировал, что использую правильную версию PHP, используя php --ini
, который говорит, что я использую 7.0. Я убедился, что путь к файлу правильный. Любая помощь приветствуется!
Обновление:
Мой путь к php7.0-fpm.sock
был неверным. Он был помещен в подкаталог php
. Теперь его заменили на:
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
После очистки кеша браузера и перезагрузки конфигурации nginx я все еще получаю ошибку 502.