Laravel 5.4 - Change URL name - laravel

So to start explaining things, I would first like to enumerate what I'm using.
I'm using Laravel 5.4 and XAMPP.
I want to deploy my project in a localhost only. So we're starting the project's server with php artisan serve --host 192.168.254.11 --port 80 where the IP stated there is the IP of the server.
In that way, we have to type the url 192.168.254.11 to access the project. Is there any way to change that without getting an online server?
EDIT: I managed to change it with tweaking of hosts file. But for it to be possible to be accessed by the other users, they have to do the same. Is there a way to only change the hosts file of the server and still be accessible by other users at the same time?

Related

Shopify CLI - How to start a local server without ngrok?

My organization blocks ngrok, so every time I run the Shopify serve command, it fails with a connection error.
So is there any way to just start the Shopify local server? that way I can use cloudfared to tunnel the local server to a subdomain.
When I search on google I found no answer to this question.
I had success running the server without the ngrok.
Here are my steps:
Prepare a cloud server, install Nginx.
config domain settings, and forward the request to your local port.
If you are using a router, only router has a public IP, so you need to forward the request to your pc. You could config it in the router.
then you need to update .env file, update host value
Go partner.shopify.com, app settings. put your URL to the whitelist.
use npm run dev to start your project.
I also set HTTPS in nginx. Due to ngrok server is far away from my location. so after using this way. the starting time is much faster.
Start the server by
npm run dev
instead of,
shopify app serve

How to deploy a laravel application that will be accessed over a LAN on a windows server?

I am tasked to develop a laravel project for our company. I have to deploy it within the company's network only. It is my first time to do it and haven't find any good source of instruction so far. I hope you can help me with this. I am using XAMPP for this one. And the machine runs on a Windows Server 2016.
Laravel applications are easy to install on IIS. You can use the url_rewrite extension to import the rules from the .htaccess file. Other than that it is really no different than deploying to any other server.
You can also use your company's local DNS to point to the server if you wish to access it via https://my-app.company.com.
May sure you all are one in common network
sudo php artisan serve --host 0.0.0.0 --port 81 (you can change the port if you want)
Other people will be able to access with you'r IP address http://your-pc-id-address:81

Move application from homestead to docker

My application consists of three domains:
example.com
admin.example.com
partner.example.com
All of these domains are handled by the same Laravel app. Each domain has its own controllers and view. Models and other core functionalities are shared between all three domains.
Currently my local dev-environment is build with Homestead (based on Vagrant), where each local domain (example.test, admin.example.test and partner.example.test) points to the same directory (e.g. /home/vagrant/app/public).
Because of deployment problems regarding different versions of OS, NPM, PHP, etc. I want to move to docker. I've read a lot of articles about multiple domains or apps with docker. Best practice seems to be to set up an Nginx reverse proxy which redirects all incoming requests to the desired app. Unfortunately, I haven't found examples for my case where all domains point to the same application.
If possible I would avoid having the same repository cloned three times for each docker container running one specific part of the app.
So what would be the best approach to set up a docker environment?
I created a simple gist for you to look at of how I would do it
https://gist.github.com/karlisabele/f7d91594c004e227e504473ce2c60508
The nginx config file is based on Laravel documetation (https://laravel.com/docs/5.8/deployment#nginx) and of course in production you would also want to handle SSL and map port 443 as well, but this should serve as POC for you.
Notice that in the nginx configuration I use the php-fpm service name to pass the request to php-fpm container. In docker the service names can be used as host names for corresponding service so the line fastcgi_pass php-fpm:9000; means that you are passing the request to php-fpm containers port 9000 (default port for the fpm image to listen to)
Basically what you want to do is simply define in the nginx that all 3 of your subdomains are handled by the same server configuration. Then nginx simply passes the request to php-fpm to actually process it.
To test, you can just copy the two files from gist in your project directory, replace YOUR_PROJECT_FOLDER in docker-compose.yml file with the actual location of your project (can be simply .:/var/www/html if you place the docker-compose.yml in the root of your project) then run docker-compose up -d. Add the domains to your hosts file (/etc/hosts un linux/mac) and you should be able to visit example.test and see your site.
Note: Depending on where your database is located, you might need to change the host for it if it's localhost at the moment, because it will try to connect to a mysql server from php-fpm container, which of course does not have it's own mysql-server running.

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

Laravel subdomain in shared hosting

Already I have hosted my laravel project http://1d1s.co and working fine. Now I wanted to create dev environment as a subdomain like http://dev.1d1s.co. Kindly help me to do.
First of all, check if your hosting and DNS provider allow subdomains.
Then, you can folow
this example
if you're using Apache2
If you're using nginx, try following this guide

Resources