0

I want to use Nginx in Amazon Linux intances. If I use a single instance with a public IP granted by Amazon, the configuration works. Then when I add an ALB and later add the target group the app fails. The same configuration with apache works correctly. What could be the problem? this is my /etc/nginx/conf.d/app.conf configuration

# PHP Upstream Handler
upstream php-handler {
    server unix:/run/php-fpm/php-fpm.sock;
}
 
server {
    listen 80;
    server_name public-alb.com;
    location / {
        root    /var/www/app;
        index index.php index.html index.htm;
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ ^(.+\.php)(.*)$ {
        root /var/www/app;
        fastcgi_split_path_info  ^(.+\.php)(.*)$;
        fastcgi_index            index.php;
        fastcgi_pass             unix:/run/php-fpm/php-fpm.sock;
        include /etc/nginx/mime.types;
        include                  fastcgi_params;
        fastcgi_param   PATH_INFO       $fastcgi_path_info;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}
user_af
  • 23
  • 4
  • What is the problem you are having? – Michael Hampton Jul 22 '20 at 02:47
  • We need a bit more information about the problem than "the app fails". It could be a range of things - target group on the wrong port, security groups, etc. You'll need to do a bit of diagnostics to track down what's wrong. – Tim Jul 22 '20 at 03:53

0 Answers0