How to run laravel websockets in laragon?
when run command to start websockets
php artisan websockets:serve
it's not working because
https://imgur.com/ODkZC8d
and its still suck there
https://imgur.com/6lzEOGX
this is error on browser
WebSocket connection to 'wss://nextlevelbot.test:6001/app/mykey?protocol=7&client=js&version=6.0.2&flash=false' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
It was my problem in SSL certifacates
I solve this problem by create SSL certificates for nextlevelbot.test and add them in folder in this path
C:\laragon\etc\ssl\nextlevelbot.test
and add path SSL certificates in .env file
LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT =C:\laragon\etc\ssl\nextlevelbot.test\server.crt
LARAVEL_WEBSOCKETS_SSL_LOCAL_PK =C:\laragon\etc\ssl\nextlevelbot.test\server.key
and edit path SSL certificates in config file for my project in this path
C:\laragon\etc\nginx\sites-enabled\auto.nextlevelbot.test.conf
ssl_certificate "C:/laragon/etc/ssl/nextlevelbot.test/server.crt";
ssl_certificate_key "C:/laragon/etc/ssl/nextlevelbot.test/server.key";
and restart nginx server in laragon
and run command composer dumpautoload
after that run command php artisan websockets:serve
after that work good :)
Generate certificates for domain
I generate certificates by this scripts
https://gist.github.com/mindscms/721cf0968ddbbff5bad0c0b359d918e6
https://gist.github.com/mindscms/a7f3e7db0b6c7bfaaab56522ebed9042
1 - Download two files make-cert.bat and cert-template.conf from link above
2 - Create folder cert in C:\laragon\bin\apache\YOUR_VIRSION_APACHE
in my case C:\laragon\bin\apache\httpd-2.4.35-win64-VC15\cert
3 - Put two file make-cert.bat and cert-template.conf in folder cert
4 - Run file make-cert.bat and answer the questions to generate certificates
5 - After finished script creates a folder with the name domain likenextlevelbot.test
C:\laragon\bin\apache\httpd-2.4.35-win64-VC15\cert\nextlevelbot.test
6 - Inside this folder two files server.crt and server.key
That was helpful but not the exact reason
as this is a local cert, it needs permission
The easiest way ( oh its quirky )
Copy the failing wss link
i.e. wss://example.test:3031/app/?protocol=7&client=js&version=4.3.1&flash=false
and replace the wss:// with https://
i.e.
https://example.test:3031/app/?protocol=7&client=js&version=4.3.1&flash=false
Open the link on another tab of same browser and accept the certification on ssl prompt
try the websockets dashboard now, refresh and voila!
By the way, if you make any change to your nginx config for domain in laragon, you should remove the auto. prefix to avoid future auto overwrite by laragon
Related
After creating a few duplicate snipe it installations I think it's better to move installed composer packages to a global location (so I won't have to download/install them each time I create a new snipe it instance). How and where should I put these ? Already moved composer to /usr/local/bin . Ultimate goal is to remove the packages from the vendor subfolders and load them from global location. What would need to be changed in the snipe it folders ?
Thanks
Running Ubuntu server 20.04
What I did was:
copy site1 to site2
create db for site2
add extra ip in apache ports.conf to listen on
add ip in netplan yaml file
create new ssl key for extra ip
created conf for site2 in sites-available + a2ensite
modified .env for url app key en db settings
My main problem is that php artisan key:generate throws an error when in root of site2. Was able to generate app key with echo "base64:$(openssl rand -base64 32)" and site2 works as it shoulds for now.
I have setup Mailgun on my Laravel project, the project will be deployed on a (Lan based) local server which hopefully connected to internet, email should be sent from the local machine where the project is being hosted, it works great on my dev server but when I try to send email from my local machine it returns below error.
cURL error 60: SSL cert issue when sending email with artisan command
You can either modify the vendor folder GuzzleHttp\Client change verify key to false from configureDefaults method as I did in my local machine
or
You can read this conversation in Laracasts and try downloading the .pem files in some of the comments.
Here are some links:
.pem File Download
After that you should edit your php.ini file accordingly:
curl.cainfo = "[pathtothisfile]\cacert.pem"
PS: I would just edit the vendor file, because it's much faster and not hard to realize.
The reason is because the mailgun/guzzleHttp looking for valid certificate (SSL issue) for security reasons.
You can solve it like below (Wamp server):
1- Download this file from http://curl.haxx.se/ca/cacert.pem and put this in "C:/wamp64/bin/php/(your php version)/extras/ssl/" directory
2- find all php.ini files (even php.ini-production and php.ini-development) under this directory "C:/wamp64/bin/php/php (your php version)"
3- find these following parts in above .ini files and edit it as shown:
curl.cainfo = "C:/wamp64/bin/php/(your php version)/extras/ssl/cacert.pem"
openssl.cafile= "C:/wamp64/bin/php/(your php version)/extras/ssl/cacert.pem"
4- clear cache laravel and restart your laravel server
5- restart wamp server
GuzzleHttp\Exception\RequestException
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
how to solve this error i am trying everything available on the google including
the below description several times
Download this file: http://curl.haxx.se/ca/cacert.pem
Place this file in the C:\wamp64\bin\php\php7.1.9 folder
Open php.iniand find this line:
;curl.cainfo
Change it to:
curl.cainfo = "C:\wamp64\bin\php\php7.1.9\cacert.pem"
But still it didn't work for me
please help me i am so frustrated right now...
You need to put .pem file inside of C:\wamp64\bin\php\php7.1.9\extras\ssl instead of C:\wamp64\bin\php\php7.1.9
Make sure the file mod_ssl.so is inside of C:\wamp64\bin\apache\apache(version)\modules
Enable mod_ssl in httpd.conf inside of Apache directory C:\wamp64\bin\apache\apache2.4.27\conf
Enable php_openssl.dll in php.ini.
In wamp there are two php.ini files and You need to do this in both of them.
First one can be located inside of your WAMP taskbar icon
and the other one is located in C:\wamp64\bin\php\php(Version)
find the location for both of the php.ini files and find the line curl.cainfo = and give it a path like this
curl.cainfo = "C:\wamp64\bin\php\php7.1.9\extras\ssl\cacert.pem"
Now save the files and restart your server
In my case this error also happened when using Laravel's development server.
In order to fix it, just shifted stopped that server and ran Apache through XAMPP and that was enough to solve the problem.
If you're having troubles with this approach, please read the answers to this question for more details.
I'm working in WAMP and Laravel on localhost. I was trying to broadcast an event using Pusher to my font end and Laravel was throwing an exception. I fixed the issue by downloading cainfo certficate from curl official website and setting curl.cainfo variable in php.ini to point to downloaded certificate. I was wondering why is this required? Is this only for WAMP or only for Pusher? Or it's because Pusher is using HTTPS?
Is it only for the PHP you're using in your Wamp to connect with services who requires SSL..
- download it from here: https://curl.haxx.se/docs/caextract.html
- Add it to your ssl folder in your php version, and modify your php.ini files (in Wamp folder and PHP folder):
curl.cainfo = "C:\wamp\bin\php{php_version}\extras\ssl\cacert.pem"
I have an application which i am using 'php artisan serve' command to run it on my mobile. I want to test it on my mobile but i have an API which requires HTTPS. So how can i configure this? I want to test this before I put this live.
Here is how my artisan command looks like:
php artisan serve --host=192.168.1.18 --port=80
The IP is my local machines IP Address which i am accessing from my mobile.
I have tried looking up google but i couldn't find the answer i was looking for.
Thanks
You can use self-signed SSL for own server.
1 - Download the certificate.
2 - Add or edit this line in php.ini config:
curl.cainfo = "[path_to_cerfificate]\cacert.pem"
3 - Then restart your server
Done.