Laravel on AWS with SSL - 404 Not Found errors - laravel

I have a laravel project I am trying to run on AWS Elasticbeanstalk - I uploaded the project and worked 100% using HTTP, the client decided they wanted SSL , when I upload the exact same source code, my landing page works perfectly (https://sitename/), however any other page such as https://sitename/login will not work at all and I receive a 404 Not Found errors message.
The output I have is as follows (I zero'ed out the ip address except the last section to give it context):
2022/05/25 03:51:46 [error] 7872#7872: *21072 open() "/var/www/html/public/login" failed (2: No such file or directory), client: 000.00.00.164, server: , request: "GET /login HTTP/1.1", host: "00.000.000.113"
2022/05/25 03:57:03 [error] 7871#7871: *21210 open() "/var/www/html/public/_debugbar/assets/javascript" failed (2: No such file or directory), client: 000.00.00.164, server: , request: "GET /_debugbar/assets/javascript?v=1644364352 HTTP/1.1", host: "portal.sitename", referrer: "https://portal.sitename/"
2022/05/25 03:57:03 [error] 7872#7872: *21209 open() "/var/www/html/public/_debugbar/assets/stylesheets" failed (2: No such file or directory), client: 000.00.00.164, server: , request: "GET /_debugbar/assets/stylesheets?v=1644364352&theme=auto HTTP/1.1", host: "portal.sitename", referrer: "https://portal.sitename/"
2022/05/25 04:01:26 [error] 7872#7872: *21313 open() "/var/www/html/public/ReportServer" failed (2: No such file or directory), client: 000.00.00.193, server: , request: "GET /ReportServer HTTP/1.1", host: "13.244.47.136"
2022/05/25 04:01:39 [error] 7872#7872: *21320 open() "/var/www/html/public/ReportServer" failed (2: No such file or directory), client: 000.00.00.164, server: , request: "GET /ReportServer HTTP/1.1", host: "00.000.000.113"
2022/05/25 04:08:15 [error] 7872#7872: *21477 open() "/var/www/html/public/login" failed (2: No such file or directory), client: 000.00.00.193, server: , request: "POST /login HTTP/1.1", host: "portal.sitename", referrer: "https://portal.sitename/"

This is happening because your server is not accepting query string in url. For solving this you should add another folder called .platform and follow the text inside laravel.conf file like below. This will be fixed
Be sure you are using nginx as server from elastic benstalk configuration
.platform configuration
laravel.conf file
location / {
try_files $uri $uri/ /index.php?$query_string;
gzip_static on;
}

There's documentation available for laravel in combination with beanstalk.
Your issue is caused by the webserver searching for files in the wrong directory. Did you choose PHP as platform? And do you have set the Document Root to /public?

Thanks to all for assisting , for anyone following this is what I did to resolve:
cd /etc/nginx/conf.d/elasticbeanstalk
nano laravel.conf
added the following code:
location / {
try_files $uri $uri/ /index.php?$query_string;
}

Related

Is it possible to do port forwarding by nginx when the port is not open?

building hadoop with hortonworks ambari. total 7 nodes.
Only 80 and 8080 port are allowed to use.
It needs to be shown some web UI such as Nifi..
Is it possible to open Nifi web ui thorough nginx?
ambari admin page address is node1:8080 and nginx address node2:80.
I set nginx.conf as below...
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# for nifi
location = /nifi {
proxy_pass http://0.0.0.0:9090/nifi;
}
But nifi show me error log like below..
2019/03/27 17:39:15 [error] 14804#0: *122 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xx.xx, server: localhost, request: "GET /nifi HTTP/1.1", upstream: "http://0.0.0.0:9090/nifi", host: "xxx.xxx.xx.xx"
It seems to needs another port 9088 as nifi protocol...
I don't think it can be resolved with nginx...
Do I need to request to use those port available?
Please give me your advice....

How do I fix php7.1-fpm.sock failure on Laravel

I am trying to solve my white screen problem. Currently, I'm unable to login to one of my staging servers. I'm running Laravel 5.2 / php 7.1-fpm. After doing a repository update(via Forge), I hit the white screen view.
Based on my domain error log, I think that fixing the php7.1-fpm.sock failure will solve my white screen error.
I've tried just about every suggestion from various forums; I've tried suggestions from several similar related stack-overflow threads.
I still haven't found a solution. Can anyone offer suggestions?
Below is the error.log contents:
2018/08/12 21:16:09 [crit] 949#949: *28 SSL_do_handshake() failed
(SSL: error:1417D102:SSL routines:tls_process_client_hello:unsupported
protocol) while SSL handshaking, client: 23.27.154.95, server:
0.0.0.0:443
2018/08/13 00:43:46 [crit] 949#949: *47 SSL_do_handshake() failed (SSL: error:1417D102:SSL
routines:tls_process_client_hello:unsupported protocol) while SSL
handshaking, client: 220.181.132.198, server: 0.0.0.0:443
2018/08/13 00:43:46 [crit] 949#949: *48 SSL_do_handshake() failed (SSL:
error:1417D18C:SSL routines:tls_process_client_hello:version too low)
while SSL handshaking, client: 220.181.132.198, server: 0.0.0.0:443
2018/08/13 00:43:47 [crit] 949#949: *49 SSL_do_handshake() failed
(SSL: error:1417D102:SSL routines:tls_process_client_hello:unsupported
protocol) while SSL handshaking, client: 220.181.132.198, server:
0.0.0.0:443
Below is my site's error log contents:
2018/08/11 17:48:31 [crit] 934#934: *1 connect() to
unix:/var/run/php/php7.1-fpm.sock failed (2: No such file or
directory) while connecting to upstream, client: 73.106.222.129,
server: blabs.goteachersintouch.com, request: "GET / HTTP/2.0",
upstream: "fastcgi://unix:/var/run/php/php7.1-fpm.sock:", host:
"blabs.goteachersintouch.com"
2018/08/11 17:48:35 [crit] 1266#1266: *1 connect() to unix:/var/run/php/php7.1-fpm.sock failed (2: No such file
or directory) while connecting to upstream, client: 73.106.222.129,
server: blabs.goteachersintouch.com, request: "GET /img/body-bg.png
HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.1-fpm.sock:",
host: "blabs.goteachersintouch.com", referrer:
"https://blabs.goteachersintouch.com/build/css/app-5aaeb8644f.css"
Before I did the Repository Uninstall with Laravel Forge, my build was working fine. Apparently setting my server to it's original PHP state is not in alignment with some configuration (there's something I'm missing, I just can't see it).
My codebase is still running on Laravel 5.2 library. But even still, can anyone offer suggestions to fix this white screen issue.
I have tried the permissions adjustments--that hasn't worked.
Thank you!
Turns out I was missing a bower file. The file was angular-sanitize#1.6.1
I ran:"bower install angular-sanitize#1.6.1" and was up and running again.

nginx proxy_pass with https protocol leads to "invalid URL prefix" error

I'm running a php app behind nginx on dokku. I got a location with a proxy_pass directive defined like this:
location ~* ^/cdn/(.*?)/(.*) {
resolver 8.8.8.8;
proxy_set_header HOST $1;
proxy_pass https://$1/$2?$args;
}
I'd like to use this location to redirect files from S3.
In the error logs I have the following error:
2016/10/03 21:56:46 [error] 251#0: *11 invalid URL prefix
in "https://s3-us-west-1.amazonaws.com/powr/defaults/image-slider2.jpg?",
client: 172.17.0.1, server: localhost,
request: "GET /cdn/s3-us-west-1.amazonaws.com/powr/defaults/image-slider2.jpg HTTP/1.1"
Everything works well if I change https:// and use http:// instead.
Any hints appreciated.
It will work, if you remove variables from the host part of your proxy_pass. I hope it will helps.
check your nginx config ,make sure your have ngx_http_ssl_module
cd /usr/sbin/
./nginx -V
should show
TLS SNI support enabled

NGINX caching proxy fails with SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure

NGINX acting as a caching proxy encounters problems when fetching content from CloudFront server over HTTPS:
This is the extract from the NGINX's error log:
2014/08/14 16:08:26 [error] 27534#0: *11560993 SSL_do_handshake() failed (SSL: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure) while SSL handshaking to upstream, client: 82.33.49.135, server: localhost, request: "GET /static/images/media-logos/best.png HTTP/1.1", upstream: "https://x.x.x.x:443/static/images/media-logos/best.png",
I tried different proxy setting like proxy_ssl_protocols and proxy_ssl_ciphers but no combination worked.
Any ideas?
I had the exactly same problem and spent a couple of hours...
I guess you are using older version of nginx (lower than 1.7)?
In nginx 1.7 you can use this directive:
proxy_ssl_server_name on;
This will force nginx to use SNI
Also, you should set the SSL protocols:
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
For earlier versions you may be able to use this patch (but I can't verify that that is working):
http://trac.nginx.org/nginx/ticket/229
2019 Update: You should avoid TLSv1 and TLSv1.1 and disable them if possible. I'll leave them in the answer as they are still valid for SNI.

passenger_base_uri not working on passenger 4.0.0rc4

We are running ruby 2.0.0-p0 with passenger 4.0.0rc (nginx/1.2.7) on ubuntu 12.04 server in production (rails 3.2.12). Just notice that the passenger_base_uri in our nginx.conf is not pointing to the base subdir. Instead it return nothing. Here is passenger_base_uri in nginx.conf:
server {
listen 80;
server_name 154.49.55.6;
root /ebs/www/;
passenger_enabled on;
rails_env production;
passenger_base_uri /nbhy;
#for rails >= 3.1, assets pipeline
location ~ ^/assets/ {
expires max;
add_header Cache-control public;
add_header ETag "";
break;
}
}
A symlink nbhy was created on the server under /ebs/www and point to /ebs/www/nbhyop/current/public. The /nbhy is the base uri for rails app.
Here is the nginx error log,
[ 2013-05-06 17:47:00.5469 718/7f5097fc0700 Pool2/Implementation.cpp:1098 ]: [App 838 stdout]
2013/05/06 17:47:26 [error] 735#0: *104 open() "/ebs/www/authentify/session" failed (2: No such file or directory), client: 6.5.5.94, server: 154.49.55.6, request: "POST /authentify/session HTTP/1.1", host: "154.49.55.6", referrer: "http://154.49.55.6/nbhy/signin"
The path above should be: /ebs/www/nbhy/authentify/session instead of /ebs/www/authentify/session.
The same config is working on passenger 3.x. How to fix this problem? Thanks for help
I believe you were using passenger_base_uri for the wrong purpose. By specifying passenger_base_uri, you are saying:
"I have another web app, living under /nbhy"
I see in the Nginx output that you were doing a POST /authentify/session. Since you are not accessing any URL under /nbhy, the passenger_base_uri option has no effect. If you POST /nbhy/authentify/session, then it'll have effect.
Perhaps you want to set the virtual host's root to /ebs/www/nbhyop/current/public?

Resources