Laravel Restful api Production Server Configuration - laravel

This is my first time moving my Laravel RESTful api to the production server in CentOS environment using apache. To make it work I have to use
APP_URL=production_ip_address
MARKET_BASE_URI=127.0.0.1:8000
and php artisan serve or i
get cURL error 7
Is there any better way to do so if my APP_URL and MARKET_BASE_URI is same? This works on my local environment with the same URL and no issues, but Connection issues when i use the same in production environment.

use
MARKET_BASE_URI=127.0.0.1:9000
run
php artisan serve --port=9000

Related

Is it possible deploying Laravel Sail developed project to Apache server?

I’m not too familiar with the server technologies. So my question is is it ok to deploy a project developed under Laravel Sail environment (which uses Nginx as default web server i guess) to a server which runs Apache? Will it work? Should i expect any problems?
Laravel Sail is not for production. It also doesn't use apache or nginx, but php's build in web server (php artisan serve). So please use your own, or have a look at my config.
I have modified the docker file to work with Sail and Apache for development purpose. You can take a look on Gitlab link here to have some idea for your production environment.

laravel production in windows server

im new in laravel and i have done my first project, I have xampp,mysql and windows server 2012 (installed with composer and laravel 7). i'm running the application in server via command below
php artisan serve --host=[ip] --port=[port]
application is running fine within the network. However, it seems super slow. I'm not sure if this the correct way of deploying it into production. Do you have any recommendation/instructions where can i run/deploy apps within the resource that I have.
Speed of your laravel project depends on many parameters like hardware config (CPU,RAM,...) and also number of users and level of requests and processes. But consider that for an app in production it's better to not use php artisan serve command. It's only for development environment. I don't that how much you know about linux but I suggest you to change your stack and use linux as your production os with nginx as web server alongside php-fpm for running your app in production. But for now you should config xmapp's apache web server to run your application from project's public folder. Here is a link you can use: https://insidert.medium.com/setting-up-laravel-project-on-windows-2aa7e4f080da
good luck

Doubts in Laravel

I was learning Laravel, I felt doubts regarding to the same.
Do we need APACHE server for Laravel? Because, without my LAMP server ON, I could do php artisan serve
Laravel server is working on HTTP, I wish to work it on HTTPS server.
Can someone help me in above questions?
Thanks in advance.
the php artisan serve is more for testing purpose, to start a development server, so you build you application as fast as you can to test it, but its not for running it to production.
and for your second question, with apache you can solve that, but if you still want to use it with the php artisan serve, you can use ngrok like this
cd <path-to-ngrok>
./ngrok http localhost:8000
https://ngrok.com/

I want to make my project run in other browser

I create a new project using laravel 5.8, and it is running on localhost:8080. How can I make it running on other url e.g https://swap.maximine.io.test?
I think we need some extra information how you created the project and how you want to run the project.
But you can change the port where the application is running on by using:
php artisan serve --port=80
To use that domain, do you own this domain? Or do you want to use it locally?
You can add the domain to you hostfile pointing to you localhost and use it as an test environment

Difference of using php artisan serve and not using it

What is the difference of using php artisan serve and by just using localhost/myproject/public?
Some of my code is not working when I'm just using the localhost/myproject/public, but when using php artisan serve all works just fine. Why is that?
main difference is who have the role to be the web server ? Means : who have the role to intercept HTTP request and provide it to PHP compiler.
With traditional web server (apache, nginx ...)
Web service will catch request, then ask php to do traitment with.
With PHP server php artisan serve php himself have role to manage this step. that means, if error happen on your process, this will shutdown your server. Apache will not be affected by this error, so rest of application will be still available.
Now about differente way to ask php to execute some code :
For Apache you can have php-mod, who are an extension of Apache or php-fpm (describe bellow)
For Nginx or other WebService, you have php-fpm or php-fastcgi, both are way (by TCP or Unix Socket) of communcation between your web service instance (processus) and php instance (processus).
php-cli who are the php instance spawn when you do php something on your terminal
For each approch you have differente php.ini and php extension to download / activate.
That means, for exemple, if you need to use Imagick library by command line tool (php-cli) and from your web server (php-mod on Apache) you have to download and activate this library on both setup.

Resources