localhost is unable to load application centos server - laravel

Trying to fire up a Laravel api and Nuxt app on the actual server by running
lets say server IP is - 10.66.22.41
npm run dev
php artisan serve --port=8001
This obviously worked on my local environment but since this is in the actual server and I am not too familiar with Centos, is there anything I should be doing different?
When I run npm run serve I get http://localhost:3001/
When I run php artisan serve --port=8001 i get http://127.0.0.1:8001
dumb question:
How should I be accessing this on the browser?

for Nuxt, added your script in package.json
"scripts": {
"dev:host": "nuxt --host 'IP-Address' --port 3001",
}
Run:
dev:host": "nuxt --host 'IP-Address' --port 3001
For Laravel:
php artisan serve --host=IP-Address --port=8001
Quick point though, What Khali should be the best practive but if you want to test or whatever you need to do , this is it.

Well, the artisan serve command, will keep the server running until you close the console, which will terminate the service! It is not an ideal setup... I would recommend that you install a webserver of some sort, and install laravel properly via composer. We cannot see how you installed NPM, or if you installed Apache? etc..
I would recommend to install centos webpanel for a starter:
http://centos-webpanel.com/
Then install composer https://linuxize.com/post/how-to-install-and-use-composer-on-centos-7/
Then install laravel using: https://laravel.com/docs/8.x/installation#installing-laravel
This is your best way to manage and run laravel on centos properly (for beginners), if you have the money for it, you should buy CPanel (https://cpanel.net/pricing/) instead of Centos WebPanel, as it offers more flexibility and features.
Good luck!

Related

Laravel project pages not showing

I have cloned a laravel project from github and when I try to use it on my localhost, all I see is the homepage, which is fully functional, but has bits of content and images missing. Then if I try to go to any other route I get an error saying The requested URL was not found on this server.
For reference I am using MAMP as the web server, I have checked the httpd file and everything seems okay, anyone got a clue what's going on?
Use these commands in order :
cp .env.example .env
composer install
php artisan key:generate
php artisan migrate:fresh --seed
npm install
npm run dev
php artisan serve

Run Laravel phpMyAdmin via php artisan serve

I have a Laravel project running with php artisan serve (no Apache or Nginx) on:
http://localhost:8000/
I have then ran this successfully
composer require phpmyadmin/phpmyadmin
My question is, what additions to Laravel's routing etc. must I do to run the following?
http://localhost:8000/phpmyadmin
Though I haven't found a specific way to have
http://localhost:8000/phpmyadmin
working through Laravel as part of php artisan serve, there is a simple solution that works just fine using PHP's native server instead, assuming you have mysql installed as localhost:
composer create-project phpmyadmin/phpmyadmin
cd phpmyadmin
ls -la #files look like classic phpMyAdmin, note however `vendor` folder in place along with package.json
php -S http://localhost:7000 #and you should be able to see and log in!
This does everything I need it to do. If you want to install phpMyAdmin through an actual webserver like Apache that runs always, you're better off doing something like apt-get [or yum] install phpmyadmin and then you'll have a directory override from Apache running:
http://www.mylaravelapp.com/phpmyadmin

I am using Putty to run and compile vue js + laravel app on Godaddy VPS. Changes are not taking effect

I am using Putty to run and compile vue js + laravel app on Godaddy VPS. Changes are not taking effect.
I have Laravel + Vue.js App on VPS.
When I make changes in code, I am running following command in Putty.
npm run dev
npm run watch
Changes are not being applied. Even when it shows all modules built successfully.
npm run watch should apply changes in code.
In local environment using wamp it works
oh, have you tried laravel cached views clear??
php artisan cache:clear

Laravel installed but confusion remains

I have ubuntu 14.04 and LAMPP is installed. I was learning Laravel 4, but get a lot of confusion on it's documentation, below I list few of issue.
How to install laravel?
what I did :
copy github repository into /opt/lampp/htdocs/larva and run composer install, Laravel is installed and I can access it with http://localhost/larva
What is homestead? is that another way to install laravel or this is additional thing?
What is artisan? if I use artisan then do we need to use homestead also?
what I did ( in terminal )
cd /opt/lampp/htdocs/larva
php artisan serve
it started the service and I can access laravel with htpp://localhost:8000 BUT if i close this terminal then URL is lost
and there is one other way is using vagrant? do we need to use vagrant if we installed it already?
one more thing is Nginx?
overall these vagrant, Nginx, Homestead, artisan,and composer methods create such a mess.
Please clear the clouds and please do not mention what is vagrant Nginx and all. I just want to know that do I need to do something with Homestead and vagrant if i have installed using git repository and composer way?
Thanks
Laravel Homestead is an official, pre-packaged Vagrant "box" that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine.
Artisan is the name of the command-line interface included with Laravel. It provides a number of helpful commands for your use while developing your application. It is driven by the powerful Symfony Console component.
When you close the terminal, you are stopping the service on port 8000. You always can create a virtual host, and point its root to your larval installation /public directory
you dont have to use vagrant to run laravel. Vagrant is just your 'bridge' to Virtual Mashine.
If you installed LAravel via composer and you got it work on localhost:8000 then you dont need neither homestead or vagrant

Can't access localhost/laravel in LAMP

I'm new to Ubuntu 14.04 and I installed LAMP and I install laravel in /var/www but it seems that I can't access localhost/laravel in my server it says.
So what I'm missing here?
Edit:
It works when i try php artisan serve then it gives me localhost:8000 but when localhost/laravel it doesn't work.
It's because of your Apache is not working. You can start your Apache by the following command
sudo service apache2 start
You can see more about start/stop/restart Apache at here.
Or if you want to re install your lamp, so you can see at here

Resources