1

Update: Sorry, my bad. For android 8+ we should have clartextTraffic=true in androidManifest.xml for http to work. This was done/present in my app but after enabling https and domain setup, I deleted that since that wasn't needed anymore. But when I started testing again with http, it was not connecting as this entry was missing. I completely forgot about that part.

Anyways, I tried with my old apache server again to see if that was working after realising no errors in nginxerror.log. That was not working as well. Then I realised it is something on the app side that changed.I compared with history to check what changes I made.

In hindsight, I should have known earlier as http was working/connecting fine through browser. Funny thing is if I had tried directly over load balancer it would have worked properly since app will be using https and this setting is not required. Anyways, wasted two days but lesson learned.:). Thank you @JonnieJS for helping/replying.

Original qn: I have a laravel/php application which was working fine in apache but I thought it might be better to move to nginx to support larger concurrent users.

When trying through http, nginx access log is completely blank and error log shows a single line notice that signal process started. When enabling debug, I get the epoll add event lines as well. Laravel log is blank as well.

Funny thing is when I try through browser (even with http), I get the laravel default page (I cannot check application itself as it is mobile only). App is using okhttp for connection, so could be something to do with that. curl -v shows a similar response and html page as well.

This is my configuration file (domain/folder changed. Restarted server and tested multiple times after changes). The default nginx configuration file is unlinked.

Any idea what might be the issue or how to resolve this?

1 Answer 1

0

I would suggest this plan:

AWS Load balancer with SSL certificates issued by AMAZON port 443. This will terminate SSL(HTTPS) and you should not care about it any more. Target group would issue all traffic in port 80 (HTTP) to instance with NGINX.

For the config look for this: https://laravel.com/docs/5.7/deployment#nginx

The actual instance should allow traffic only from the load balancer - from it's private IP. This will prevent to bypass your ELB.

If Laravel mistakenly thinks all URLs should use http:// instead of https:// you can try to look at URL::forceSchema('https');

Edit:

Please read more here: https://aws.amazon.com/blogs/aws/elastic-load-balancer-support-for-ssl-termination/

To make this more clear:

  1. client request https://exmaple.com/page-1 which resolves to 1.2.3.4 = the load balancer.
  2. Load balancer has SSL certificates, so it decrypt the traffic and send http traffic to the instance. so this looks like http://172.1.0.1/page-1
  3. NGINX has the following tasks:
    1. listen on port 80.
    2. pass the traffic to the handler (PHP or equivalent)

Hope this makes it more clear.

16
  • It is http that is not working not https. And yes, using load balancer with http is the plan as mentioned in the question.
    – Justin
    Mar 29, 2020 at 11:50
  • Please see my edit above.
    – JonnieJS
    Mar 30, 2020 at 7:18
  • Hi @JonnieJS, nginx already configured to listen to port 80 and configured. But somehow it doesn't work. NGINX doesn't work with http. That is what I am asking in this qn. I know how load balancer work. That is why I am trying to connect using http.
    – Justin
    Mar 30, 2020 at 8:38
  • If you know why nginx doesn't work for http (check configuration file in the qn) and know how to fix that let me know.
    – Justin
    Mar 30, 2020 at 8:49
  • 1
    Please run nginx -t to check for problems. For what i'm seeing, this conf is okay.
    – JonnieJS
    Mar 30, 2020 at 9:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .