部署我的symfony项目并收到502错误

时间:2018-11-02 19:51:26

标签: symfony nginx

因此,我想将我的简单项目以symfony的形式发布到Web。为此,我有带有LEMP的小型专用服务器。我根据https://symfony.com/doc/current/setup/web_server_configuration.html#nginx配置了nginx.conf,但收到502错误。 这是我的nginx.conf

    #user html;
worker_processes  4;

events {
    worker_connections  4096;
}


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

    index index.php index.html index.htm index.nginx-debian.html;

    server{
      listen 80;
      server_name localhost;
      return 301 https://www.mydoamin.pl$request_uri;
    }


    server {
          listen 443 ssl;
          server_name  mydomain.pl www.mydomain.pl;

        error_page      404 /404.php;

      ssl_protocols TLSv1.1 TLSv1.2;
      ssl_certificate /etc/letsencrypt/live/www.mydomain.pl/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/www.mydomain.pl/privkey.pem;

          root  /usr/share/nginx/html/public; 

   location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }

      location ~ \.php {
        try_files $uri /index.php =404;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_index index.php;
        include fastcgi_params;
      }

    location ~ \.php$ {
        return 404;
    }



    error_log /var/log/nginx/symfony_error.log;
    access_log /var/log/nginx/symfony_access.log;
        }
    }

有什么想法吗? ; P

0 个答案:

没有答案